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

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 16 15:32:14 PDT 2012


Revision: 8900
          http://trac.macosforge.org/projects/calendarserver/changeset/8900
Author:   sagen at apple.com
Date:     2012-03-16 15:32:14 -0700 (Fri, 16 Mar 2012)
Log Message:
-----------
During migration, trigger copying of locations/resources out of OD

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

Modified: CalendarServer/trunk/contrib/migration/calendarmigrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarmigrator.py	2012-03-16 21:45:09 UTC (rev 8899)
+++ CalendarServer/trunk/contrib/migration/calendarmigrator.py	2012-03-16 22:32:14 UTC (rev 8900)
@@ -42,6 +42,7 @@
 NEW_CONFIG_DIR = "Library/Server/" + NEW_SERVER_DIR + "/Config"
 LOG_DIR = "var/log/caldavd"
 DITTO = "/usr/bin/ditto"
+RESOURCE_MIGRATION_TRIGGER = "trigger_resource_migration"
 
 
 # Processed by mergePlist
@@ -155,7 +156,10 @@
             # Set ownership
             os.chown(logDir, uid, gid)
 
+            # Trigger migration of locations and resources from OD
+            triggerResourceMigration(newServerRoot)
 
+
     else:
         log("ERROR: --sourceRoot and --sourceVersion must be specified")
         sys.exit(1)
@@ -590,6 +594,22 @@
     )
 
 
+def triggerResourceMigration(newServerRoot):
+    """
+    Leave a file in the server root to act as a signal that the server
+    should migrate locations and resources from OD when it starts up.
+    """
+    triggerPath = os.path.join(newServerRoot, RESOURCE_MIGRATION_TRIGGER)
+    if not os.path.exists(newServerRoot):
+        log("New server root directory doesn't exist: %s" % (newServerRoot,))
+        return
+
+    if not os.path.exists(triggerPath):
+        # Create an empty trigger file
+        log("Creating resource migration trigger file: %s" % (triggerPath,))
+        open(triggerPath, "w").close()
+
+
 def relativize(parent, child):
     """
     If child is really a child of parent, make child relative to parent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120316/f319c322/attachment-0001.html>


More information about the calendarserver-changes mailing list