[CalendarServer-changes] [8104] CalendarServer/trunk/txdav/common/datastore

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 15 10:55:33 PDT 2011


Revision: 8104
          http://trac.macosforge.org/projects/calendarserver/changeset/8104
Author:   sagen at apple.com
Date:     2011-09-15 10:55:32 -0700 (Thu, 15 Sep 2011)
Log Message:
-----------
Clean up migrated addressbook/calendar homes

Modified Paths:
--------------
    CalendarServer/trunk/txdav/common/datastore/test/test_util.py
    CalendarServer/trunk/txdav/common/datastore/util.py

Modified: CalendarServer/trunk/txdav/common/datastore/test/test_util.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/test_util.py	2011-09-15 17:31:31 UTC (rev 8103)
+++ CalendarServer/trunk/txdav/common/datastore/test/test_util.py	2011-09-15 17:55:32 UTC (rev 8104)
@@ -101,13 +101,10 @@
                 self.assertNotIdentical(
                     None, (yield txn.calendarHomeWithUID(uid))
                 )
-        # Un-migrated data should be preserved.
-        self.assertEquals(self.filesPath.child("calendars-migrated").child(
-            "__uids__").child("ho").child("me").child("home1").child(
-                ".some-extra-data").getContent(),
-                "some extra data"
-        )
-        
+        # Successfully migrated calendar homes are deleted
+        self.assertFalse(self.filesPath.child("calendars").child(
+            "__uids__").child("ho").child("me").child("home1").exists())
+
         # Want metadata preserved
         home = (yield txn.calendarHomeWithUID("home1"))
         calendar = (yield home.calendarWithName("calendar_1"))
@@ -209,13 +206,10 @@
                 self.assertNotIdentical(
                     None, (yield txn.addressbookHomeWithUID(uid))
                 )
-        # Un-migrated data should be preserved.
-        self.assertEquals(self.filesPath.child("addressbooks-migrated").child(
-            "__uids__").child("ho").child("me").child("home1").child(
-                ".some-extra-data").getContent(),
-                "some extra data"
-        )
-        
+        # Successfully migrated addressbook homes are deleted
+        self.assertFalse(self.filesPath.child("addressbooks").child(
+            "__uids__").child("ho").child("me").child("home1").exists())
+
         # Want metadata preserved
         home = (yield txn.addressbookHomeWithUID("home1"))
         adbk = (yield home.addressbookWithName("addressbook_1"))

Modified: CalendarServer/trunk/txdav/common/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/util.py	2011-09-15 17:31:31 UTC (rev 8103)
+++ CalendarServer/trunk/txdav/common/datastore/util.py	2011-09-15 17:55:32 UTC (rev 8104)
@@ -162,18 +162,9 @@
                 yield sqlTxn.commit()
                 # FIXME: need a public remove...HomeWithUID() for de-
                 # provisioning
-                storePath = self.fileStore._path # Documents
-                topPath = storePath.child(topPathName) # calendars|addressbooks
-                fromParent = fileHome._path.segmentsFrom(topPath)
-                topPath = topPath.realpath() # follow possible symlink
-                backupPath = topPath.sibling(topPathName + "-migrated")
-                for segment in fromParent:
-                    try:
-                        backupPath.createDirectory()
-                    except OSError:
-                        pass
-                    backupPath = backupPath.child(segment)
-                fileHome._path.moveTo(backupPath)
+
+                # Remove file home after migration
+                fileHome._path.remove()
         for homeType in TOPPATHS:
             homesPath = self.fileStore._path.child(homeType)
             if homesPath.isdir():
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110915/fe5e456f/attachment-0001.html>


More information about the calendarserver-changes mailing list