[CalendarServer-changes] [8102] CalendarServer/trunk/contrib/migration/calendarmigrator.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 14 16:21:16 PDT 2011


Revision: 8102
          http://trac.macosforge.org/projects/calendarserver/changeset/8102
Author:   sagen at apple.com
Date:     2011-09-14 16:21:13 -0700 (Wed, 14 Sep 2011)
Log Message:
-----------
Examine the EnableCalDAV and EnableCardDAV values from the previous system caldavd.plist in order to determine which services should be running after upgrade/migration (don't just look at launchd settings since AB no longer has one).

Modified Paths:
--------------
    CalendarServer/trunk/contrib/migration/calendarmigrator.py

Modified: CalendarServer/trunk/contrib/migration/calendarmigrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarmigrator.py	2011-09-14 20:08:58 UTC (rev 8101)
+++ CalendarServer/trunk/contrib/migration/calendarmigrator.py	2011-09-14 23:21:13 UTC (rev 8102)
@@ -276,8 +276,8 @@
     CardDAV was enabled
     """
 
-    enableCalDAV = False
-    enableCardDAV = False
+    enableCalDAV = None
+    enableCardDAV = None
 
     try:
         disabled = isServiceDisabled(options.sourceRoot, CALDAV_LAUNCHD_KEY)
@@ -297,6 +297,27 @@
         log("Couldn't determine previous state of addressbook service '%s': %s" %
             (CARDDAV_LAUNCHD_KEY, e))
 
+    if enableCalDAV:
+        # Check previous plist in case previous system was Lion, since there
+        # is now only one launchd key for both services
+        oldCalDAVPlistPath = os.path.join(options.sourceRoot,
+            CALDAVD_CONFIG_DIR, CALDAVD_PLIST)
+        if os.path.exists(oldCalDAVPlistPath):
+            log("Examining previous caldavd.plist for EnableCalDAV and EnableCardDAV: %s" % (oldCalDAVPlistPath,))
+            oldCalDAVDPlist = readPlist(oldCalDAVPlistPath)
+            if "EnableCalDAV" in oldCalDAVDPlist:
+                enableCalDAV = oldCalDAVDPlist["EnableCalDAV"]
+                log("Based on caldavd.plist, setting EnableCalDAV to %s" % (enableCalDAV,))
+            if "EnableCardDAV" in oldCalDAVDPlist:
+                enableCardDAV = oldCalDAVDPlist["EnableCardDAV"]
+                log("Based on caldavd.plist, setting EnableCardDAV to %s" % (enableCardDAV,))
+
+    # A value of None means we weren't able to determine, so default to off
+    if enableCalDAV is None:
+        enableCalDAV = False
+    if enableCardDAV is None:
+        enableCardDAV = False
+
     return (enableCalDAV, enableCardDAV)
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110914/8fa25213/attachment.html>


More information about the calendarserver-changes mailing list