[CalendarServer-changes] [7102] CalendarServer/trunk/contrib/migration
source_changes at macosforge.org
source_changes at macosforge.org
Sun Mar 6 13:35:48 PST 2011
Revision: 7102
http://trac.macosforge.org/projects/calendarserver/changeset/7102
Author: sagen at apple.com
Date: 2011-03-06 13:35:46 -0800 (Sun, 06 Mar 2011)
Log Message:
-----------
Handle migration scenario when all previous port-related settings are missing
Modified Paths:
--------------
CalendarServer/trunk/contrib/migration/calendarmigrator.py
CalendarServer/trunk/contrib/migration/test/test_migrator.py
Modified: CalendarServer/trunk/contrib/migration/calendarmigrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarmigrator.py 2011-03-04 22:43:25 UTC (rev 7101)
+++ CalendarServer/trunk/contrib/migration/calendarmigrator.py 2011-03-06 21:35:46 UTC (rev 7102)
@@ -405,18 +405,24 @@
del combined["DirectoryService"]["params"][key]
# Merge ports
+ if not caldav.get("HTTPPort", 0):
+ caldav["HTTPPort"] = 8008
+ if not carddav.get("HTTPPort", 0):
+ carddav["HTTPPort"] = 8800
if not caldav.get("SSLPort", 0):
caldav["SSLPort"] = 8443
if not carddav.get("SSLPort", 0):
carddav["SSLPort"] = 8843
+
for portType in ["HTTPPort", "SSLPort"]:
bindPorts = list(set(caldav.get("Bind%ss" % (portType,), [])).union(set(carddav.get("Bind%ss" % (portType,), []))))
- if caldav[portType] and caldav[portType] not in bindPorts:
- bindPorts.append(caldav[portType])
- if carddav[portType] and carddav[portType] not in bindPorts:
- bindPorts.append(carddav[portType])
+ for prev in (carddav, caldav):
+ port = prev.get(portType, 0)
+ if port and port not in bindPorts:
+ bindPorts.append(port)
bindPorts.sort()
combined["Bind%ss" % (portType,)] = bindPorts
+
combined["HTTPPort"] = caldav["HTTPPort"]
combined["SSLPort"] = caldav["SSLPort"]
@@ -426,10 +432,10 @@
sslPrivateKey = ""
enableSSL = False
for prev in (carddav, caldav):
- if (prev["SSLPort"] and prev["SSLCertificate"]):
- sslAuthorityChain = prev["SSLAuthorityChain"]
- sslCertificate = prev["SSLCertificate"]
- sslPrivateKey = prev["SSLPrivateKey"]
+ if (prev["SSLPort"] and prev.get("SSLCertificate", "")):
+ sslAuthorityChain = prev.get("SSLAuthorityChain", "")
+ sslCertificate = prev.get("SSLCertificate", "")
+ sslPrivateKey = prev.get("SSLPrivateKey", "")
enableSSL = True
combined["SSLAuthorityChain"] = sslAuthorityChain
Modified: CalendarServer/trunk/contrib/migration/test/test_migrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/test/test_migrator.py 2011-03-04 22:43:25 UTC (rev 7101)
+++ CalendarServer/trunk/contrib/migration/test/test_migrator.py 2011-03-06 21:35:46 UTC (rev 7102)
@@ -239,3 +239,20 @@
+ # All settings missing!
+ oldCalDAV = { }
+ oldCardDAV = { }
+ expected = {
+ "BindHTTPPorts": [8008, 8800],
+ "BindSSLPorts": [8443, 8843],
+ "EnableSSL" : False,
+ "HTTPPort": 8008,
+ "RedirectHTTPToHTTPS": False,
+ "SSLAuthorityChain": "",
+ "SSLCertificate": "",
+ "SSLPort": 8443,
+ "SSLPrivateKey": "",
+ }
+ newCombined = { }
+ mergePlist(oldCalDAV, oldCardDAV, newCombined)
+ self.assertEquals(newCombined, expected)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110306/7f970c18/attachment.html>
More information about the calendarserver-changes
mailing list