[CalendarServer-changes] [7653] CalendarServer/trunk/contrib/migration

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 23 16:54:01 PDT 2011


Revision: 7653
          http://trac.macosforge.org/projects/calendarserver/changeset/7653
Author:   sagen at apple.com
Date:     2011-06-23 16:54:01 -0700 (Thu, 23 Jun 2011)
Log Message:
-----------
In some cases, the old Wiki URL will be in caldavd.plist after migration, so this will remove it if it's not already pointed at port 8089 (the new port#)

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-06-23 21:59:45 UTC (rev 7652)
+++ CalendarServer/trunk/contrib/migration/calendarmigrator.py	2011-06-23 23:54:01 UTC (rev 7653)
@@ -445,11 +445,23 @@
         if key in caldav:
             combined[key] = caldav[key]
 
-    # "Wiki" is a new authentication in v2.x; copy all "Authentication" sub-keys    # over, and "Wiki" will be picked up from the new plist:
+    # Copy all "Authentication" sub-keys
     if "Authentication" in caldav:
+        if "Authentication" not in combined:
+            combined["Authentication"] = { }
         for key in caldav["Authentication"]:
             combined["Authentication"][key] = caldav["Authentication"][key]
 
+        # Examine the Wiki URL -- if it's using :8089 then we leave the Wiki
+        # section as is.  Otherwise, reset it so that it picks up the coded
+        # default
+        if "Wiki" in combined["Authentication"]:
+            if "URL" in combined["Authentication"]["Wiki"]:
+                url = combined["Authentication"]["Wiki"]["URL"]
+                if ":8089" not in url:
+                    combined["Authentication"]["Wiki"] = { "Enabled" : True }
+
+
     # Strip out any unknown params from the DirectoryService:
     if "DirectoryService" in caldav:
         combined["DirectoryService"] = caldav["DirectoryService"]

Modified: CalendarServer/trunk/contrib/migration/test/test_migrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/test/test_migrator.py	2011-06-23 21:59:45 UTC (rev 7652)
+++ CalendarServer/trunk/contrib/migration/test/test_migrator.py	2011-06-23 23:54:01 UTC (rev 7653)
@@ -338,6 +338,80 @@
         self.assertEquals(newCombined, expected)
 
 
+    def test_mergeAuthentication(self):
+
+        # Ensure caldavd Authentication config for wiki gets reset because
+        # the port number has changed for the wiki rpc url
+
+        oldCalDAV = {
+            "Authentication": {
+                "Wiki" : {
+                    "UseSSL" : False,
+                    "Enabled" : True,
+                    "Hostname" : "127.0.0.1",
+                    "URL" : "http://127.0.0.1/RPC2",
+                },
+            },
+        }
+        oldCardDAV = { "Is this ignored?" : True }
+        expected = {
+            "Authentication": {
+                "Wiki" : {
+                    "Enabled" : True,
+                },
+            },
+            "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)
+
+        # If the port is :8089, leave the wiki config as is, since it's
+        # already set for Lio
+
+        oldCalDAV = {
+            "Authentication": {
+                "Wiki" : {
+                    "UseSSL" : False,
+                    "Enabled" : True,
+                    "Hostname" : "127.0.0.1",
+                    "URL" : "http://127.0.0.1:8089/RPC2",
+                },
+            },
+        }
+        oldCardDAV = { "Is this ignored?" : True }
+        expected = {
+            "Authentication": {
+                "Wiki" : {
+                    "UseSSL" : False,
+                    "Enabled" : True,
+                    "Hostname" : "127.0.0.1",
+                    "URL" : "http://127.0.0.1:8089/RPC2",
+                },
+            },
+            "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)
+
+
     def test_examinePreviousSystem(self):
         """
         Set up a virtual system in various configurations, then ensure the
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110623/8fca7c4e/attachment-0001.html>


More information about the calendarserver-changes mailing list