[CalendarServer-changes] [10077] CalendarServer/branches/release/CalendarServer-4.2-dev

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 16 17:33:12 PST 2012


Revision: 10077
          http://trac.calendarserver.org//changeset/10077
Author:   sagen at apple.com
Date:     2012-11-16 17:33:12 -0800 (Fri, 16 Nov 2012)
Log Message:
-----------
Delete the RunRoot and PIDFile keys so we use the new defaults

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-4.2-dev/support/Makefile.Apple

Added Paths:
-----------
    CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/calendarcommonextra.py
    CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/test/test_commonextra.py

Added: CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/calendarcommonextra.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/calendarcommonextra.py	                        (rev 0)
+++ CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/calendarcommonextra.py	2012-11-17 01:33:12 UTC (rev 10077)
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# CommonExtra script for calendar server.
+#
+# Copyright (c) 2012 Apple Inc.  All Rights Reserved.
+#
+# IMPORTANT NOTE:  This file is licensed only for use on Apple-labeled
+# computers and is subject to the terms and conditions of the Apple
+# Software License Agreement accompanying the package this file is a
+# part of.  You may not port this file to another platform without
+# Apple's written consent.
+
+import os
+from plistlib import readPlist, writePlist
+
+CALENDAR_SERVER_ROOT = "/Library/Server/Calendar and Contacts"
+DEST_CONFIG_DIR = "%s/Config" % (CALENDAR_SERVER_ROOT,)
+CALDAVD_PLIST = "caldavd.plist"
+
+
+def updatePlist(plistData):
+    """
+    Remove the RunRoot, PIDFile keys so they use new defaults
+
+    @param plistData: the plist data to update in place
+    @type plistData: C{dict}
+    """
+
+    try:
+        del plistData["RunRoot"]
+    except:
+        pass
+    try:
+        del plistData["PIDFile"]
+    except:
+        pass
+
+
+def main():
+
+    plistPath = os.path.join(DEST_CONFIG_DIR, CALDAVD_PLIST)
+
+    if os.path.exists(plistPath):
+        try:
+            plistData = readPlist(plistPath)
+            updatePlist(plistData)
+            writePlist(plistData, plistPath)
+
+        except Exception, e:
+            print "Unable to update values in %s: %s" % (plistPath, e)
+
+
+if __name__ == '__main__':
+    main()

Added: CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/test/test_commonextra.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/test/test_commonextra.py	                        (rev 0)
+++ CalendarServer/branches/release/CalendarServer-4.2-dev/contrib/migration/test/test_commonextra.py	2012-11-17 01:33:12 UTC (rev 10077)
@@ -0,0 +1,39 @@
+##
+# Copyright (c) 2012 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+import twistedcaldav.test.util
+from contrib.migration.calendarcommonextra import updatePlist
+
+class CommonExtraTests(twistedcaldav.test.util.TestCase):
+    """
+    Calendar Server CommonExtra Tests
+    """
+
+    def test_updatePlist(self):
+        """
+        Verify RunRoot and PIDFile keys are removed
+        """
+
+        orig = {
+            "RunRoot" : "xyzzy",
+            "PIDFile" : "plugh",
+            "ignored" : "ignored",
+        }
+        expected = {
+            "ignored" : "ignored",
+        }
+        updatePlist(orig)
+        self.assertEquals(orig, expected)

Modified: CalendarServer/branches/release/CalendarServer-4.2-dev/support/Makefile.Apple
===================================================================
--- CalendarServer/branches/release/CalendarServer-4.2-dev/support/Makefile.Apple	2012-11-17 00:37:58 UTC (rev 10076)
+++ CalendarServer/branches/release/CalendarServer-4.2-dev/support/Makefile.Apple	2012-11-17 01:33:12 UTC (rev 10077)
@@ -114,6 +114,10 @@
 	$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SERVERSETUP)/MigrationExtras"
 	$(_v) $(INSTALL_FILE) "$(Sources)/contrib/migration/calendarmigrator.py" "$(DSTROOT)$(SERVERSETUP)/MigrationExtras/70_calendarmigrator.py"
 	$(_v) chmod ugo+x "$(DSTROOT)$(SERVERSETUP)/MigrationExtras/70_calendarmigrator.py"
+	@echo "Installing common extras script..."
+	$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SERVERSETUP)/CommonExtras"
+	$(_v) $(INSTALL_FILE) "$(Sources)/contrib/migration/calendarcommonextra.py" "$(DSTROOT)$(SERVERSETUP)/CommonExtras/70_calendarcommonextra.py"
+	$(_v) chmod ugo+x "$(DSTROOT)$(SERVERSETUP)/CommonExtras/70_calendarcommonextra.py"
 	@echo "Installing server promotion config..."
 	$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SERVERSETUP)/PromotionExtras"
 	$(_v) $(INSTALL_FILE) "$(Sources)/contrib/migration/calendarpromotion.py" "$(DSTROOT)$(SERVERSETUP)/PromotionExtras/59_calendarpromotion.py"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121116/acb94bd6/attachment.html>


More information about the calendarserver-changes mailing list