[CalendarServer-changes] [9388] CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/ migration
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jun 26 17:10:41 PDT 2012
Revision: 9388
http://trac.macosforge.org/projects/calendarserver/changeset/9388
Author: sagen at apple.com
Date: 2012-06-26 17:10:41 -0700 (Tue, 26 Jun 2012)
Log Message:
-----------
pull over r9387 from trunk
Revision Links:
--------------
http://trac.macosforge.org/projects/calendarserver/changeset/9387
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/calendarmigrator.py
CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/test/test_migrator.py
Modified: CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/calendarmigrator.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/calendarmigrator.py 2012-06-26 23:59:09 UTC (rev 9387)
+++ CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/calendarmigrator.py 2012-06-27 00:10:41 UTC (rev 9388)
@@ -649,11 +649,12 @@
if not diskAccessor.exists(newDataRoot):
diskAccessor.mkdir(newDataRoot)
newDocumentRoot = os.path.join(newDataRootValue, "Documents")
- if diskAccessor.exists(os.path.join(oldServerRootValue, "Documents")):
- diskAccessor.rename(os.path.join(oldServerRootValue, "Documents"),
- newDocumentRoot)
- else:
- diskAccessor.mkdir(newDocumentRoot)
+ if not diskAccessor.exists(newDocumentRoot):
+ if diskAccessor.exists(os.path.join(oldServerRootValue, "Documents")):
+ diskAccessor.rename(os.path.join(oldServerRootValue, "Documents"),
+ newDocumentRoot)
+ else:
+ diskAccessor.mkdir(newDocumentRoot)
elif diskAccessor.exists(absolutePathWithRoot(sourceRoot, oldServerRootValue)):
log("Copying calendar server root: %s" % (newServerRoot,))
diskAccessor.ditto(
@@ -664,21 +665,26 @@
if not diskAccessor.exists(newDataRoot):
diskAccessor.mkdir(newDataRoot)
newDocumentRoot = os.path.join(newDataRoot, "Documents")
- if diskAccessor.exists(os.path.join(newServerRoot, "Documents")):
- log("Moving Documents into Data root: %s" % (newDataRoot,))
- diskAccessor.rename(os.path.join(newServerRoot, "Documents"),
- newDocumentRoot)
- else:
- diskAccessor.mkdir(newDocumentRoot)
+ if not diskAccessor.exists(newDocumentRoot):
+ if diskAccessor.exists(os.path.join(newServerRoot, "Documents")):
+ log("Moving Documents into Data root: %s" % (newDataRoot,))
+ diskAccessor.rename(os.path.join(newServerRoot, "Documents"),
+ newDocumentRoot)
+ else:
+ diskAccessor.mkdir(newDocumentRoot)
else:
- log("Creating new calendar server root: %s" % (newServerRoot,))
- diskAccessor.mkdir(newServerRoot)
+ if not diskAccessor.exists(newServerRoot):
+ log("Creating new calendar server root: %s" % (newServerRoot,))
+ diskAccessor.mkdir(newServerRoot)
newDataRoot = os.path.join(newServerRoot, "Data")
- diskAccessor.mkdir(newDataRoot)
+ if not diskAccessor.exists(newDataRoot):
+ log("Creating new data root: %s" % (newDataRoot,))
+ diskAccessor.mkdir(newDataRoot)
newDocumentRoot = os.path.join(newDataRoot, "Documents")
- diskAccessor.mkdir(newDocumentRoot)
+ if not diskAccessor.exists(newDocumentRoot):
+ log("Creating new document root: %s" % (newDocumentRoot,))
+ diskAccessor.mkdir(newDocumentRoot)
-
else: # 10.8 -> 10.8
if oldServerRootValue:
Modified: CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/test/test_migrator.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/test/test_migrator.py 2012-06-26 23:59:09 UTC (rev 9387)
+++ CalendarServer/branches/release/CalendarServer-4.1-dev/contrib/migration/test/test_migrator.py 2012-06-27 00:10:41 UTC (rev 9388)
@@ -1283,6 +1283,70 @@
),
(
+ "Lion -> Mountain Lion Migration, all in default locations, with existing Data/Documents",
+ {
+ "/Library/Server/Previous/private/etc/caldavd/caldavd.plist" : """
+ <plist version="1.0">
+ <dict>
+ <key>ServerRoot</key>
+ <string>/Library/Server/Calendar and Contacts</string>
+ <key>DocumentRoot</key>
+ <string>Documents</string>
+ <key>DataRoot</key>
+ <string>Data</string>
+ <key>UserName</key>
+ <string>calendar</string>
+ <key>GroupName</key>
+ <string>calendar</string>
+ </dict>
+ </plist>
+ """,
+ "/Volumes/new/private/etc/caldavd/caldavd.plist" : """
+ <plist version="1.0">
+ <dict>
+ <key>ServerRoot</key>
+ <string>/Library/Server/Calendar and Contacts</string>
+ <key>DocumentRoot</key>
+ <string>Documents</string>
+ <key>DataRoot</key>
+ <string>Data</string>
+ <key>UserName</key>
+ <string>calendar</string>
+ <key>GroupName</key>
+ <string>calendar</string>
+ </dict>
+ </plist>
+ """,
+
+ "/Library/Server/Previous/Library/Server/Calendar and Contacts/Documents/" : True,
+ "/Library/Server/Previous/Library/Server/Calendar and Contacts/Data/" : True,
+ "/Volumes/new/Library/Server/Calendar and Contacts/" : True,
+ "/Volumes/new/Library/Server/Calendar and Contacts/Data" : True,
+ "/Volumes/new/Library/Server/Calendar and Contacts/Data/Documents" : True,
+ "/Volumes/new/Library/Server/Calendar and Contacts/Documents" : True,
+ },
+ ( # args
+ "/Library/Server/Previous", # sourceRoot
+ "/Volumes/new", # targetRoot
+ "10.7.3", # sourceVersion
+ "/Library/Server/Calendar and Contacts", # oldServerRootValue
+ "Documents", # oldCalDocumentRootValue
+ "Data", # oldCalDataRootValue
+ None, # oldABDocumentRootValue
+ FakeUser.pw_uid, FakeGroup.gr_gid, # user id, group id
+ ),
+ ( # expected return values
+ "/Volumes/new/Library/Server/Calendar and Contacts",
+ "/Library/Server/Calendar and Contacts",
+ "Data"
+ ),
+ [
+ ('ditto', '/Library/Server/Previous/Library/Server/Calendar and Contacts', '/Volumes/new/Library/Server/Calendar and Contacts'),
+ ('chown-recursive', '/Volumes/new/Library/Server/Calendar and Contacts', FakeUser.pw_uid, FakeGroup.gr_gid),
+ ]
+ ),
+
+ (
"Lion -> Mountain Lion Migration, external ServerRoot",
{
"/Library/Server/Previous/private/etc/caldavd/caldavd.plist" : """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120626/ce68a18c/attachment-0001.html>
More information about the calendarserver-changes
mailing list