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

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 15 10:09:58 PDT 2012


Revision: 8876
          http://trac.macosforge.org/projects/calendarserver/changeset/8876
Author:   sagen at apple.com
Date:     2012-03-15 10:09:56 -0700 (Thu, 15 Mar 2012)
Log Message:
-----------
Disable services on promotion/migration

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

Modified: CalendarServer/trunk/contrib/migration/calendarmigrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarmigrator.py	2012-03-15 05:33:42 UTC (rev 8875)
+++ CalendarServer/trunk/contrib/migration/calendarmigrator.py	2012-03-15 17:09:56 UTC (rev 8876)
@@ -320,8 +320,12 @@
     # If SSL is enabled, redirect HTTP to HTTPS.
     combined["RedirectHTTPToHTTPS"] = enableSSL
 
+    # Default services to disabled
+    combined["EnableCalDAV"] = False
+    combined["EnableCardDAV"] = False
 
 
+
 def log(msg):
     try:
         timestamp = datetime.datetime.now().strftime("%b %d %H:%M:%S")

Modified: CalendarServer/trunk/contrib/migration/calendarpromotion.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarpromotion.py	2012-03-15 05:33:42 UTC (rev 8875)
+++ CalendarServer/trunk/contrib/migration/calendarpromotion.py	2012-03-15 17:09:56 UTC (rev 8876)
@@ -14,10 +14,12 @@
 import shutil
 from pwd import getpwnam
 from grp import getgrnam
+from plistlib import readPlist, writePlist
 
 SRC_CONFIG_DIR = "/Applications/Server.app/Contents/ServerRoot/private/etc/caldavd"
 CALENDAR_SERVER_ROOT = "/Library/Server/Calendar and Contacts"
 DEST_CONFIG_DIR = "%s/Config" % (CALENDAR_SERVER_ROOT,)
+CALDAVD_PLIST = "caldavd.plist"
 USER_NAME = "calendar"
 GROUP_NAME = "calendar"
 LOG_DIR = "/var/log/caldavd"
@@ -34,6 +36,17 @@
         # Already exists
         pass
 
+    # Turn off services in case this is a re-promotion
+    plistPath = os.path.join(DEST_CONFIG_DIR, CALDAVD_PLIST)
+    if os.path.exists(plistPath):
+        try:
+            plistData = readPlist(plistPath)
+            plistData["EnableCalDAV"] = False
+            plistData["EnableCardDAV"] = False
+            writePlist(plistData, plistPath)
+        except Exception, e:
+            print "Unable to disable services in %s: %s" % (plistPath, e)
+
     # Create log directory
     try:
         os.mkdir(LOG_DIR, 0755)

Modified: CalendarServer/trunk/contrib/migration/test/test_migrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/test/test_migrator.py	2012-03-15 05:33:42 UTC (rev 8875)
+++ CalendarServer/trunk/contrib/migration/test/test_migrator.py	2012-03-15 17:09:56 UTC (rev 8876)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2011 Apple Inc. All rights reserved.
+# Copyright (c) 2012 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -95,6 +95,8 @@
             "SSLCertificate": "/etc/certificates/test.cert.pem",
             "SSLPort": 8443,
             "SSLPrivateKey": "/etc/certificates/test.key.pem",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -131,6 +133,8 @@
             "SSLCertificate": "",
             "SSLPort": 8443,
             "SSLPrivateKey": "",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -167,6 +171,8 @@
             "SSLCertificate": "/etc/certificates/test.cert.pem",
             "SSLPort": 8443,
             "SSLPrivateKey": "/etc/certificates/test.key.pem",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -203,6 +209,8 @@
             "SSLCertificate": "/etc/certificates/test.cert.pem",
             "SSLPort": 8443,
             "SSLPrivateKey": "/etc/certificates/test.key.pem",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -239,6 +247,8 @@
             "SSLCertificate": "/etc/certificates/test.cert.pem",
             "SSLPort": 9999,
             "SSLPrivateKey": "/etc/certificates/test.key.pem",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -272,6 +282,8 @@
             "SSLCertificate": "",
             "SSLPort": 8443,
             "SSLPrivateKey": "",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -300,6 +312,8 @@
             "SSLCertificate": "/etc/certificates/test.cert.pem",
             "SSLPort": 8443,
             "SSLPrivateKey": "/etc/certificates/test.key.pem",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -319,6 +333,8 @@
             "SSLCertificate": "",
             "SSLPort": 8443,
             "SSLPrivateKey": "",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -364,6 +380,8 @@
             "SSLCertificate": "",
             "SSLPort": 8443,
             "SSLPrivateKey": "",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
@@ -401,6 +419,8 @@
             "SSLCertificate": "",
             "SSLPort": 8443,
             "SSLPrivateKey": "",
+            "EnableCalDAV" : False,
+            "EnableCardDAV" : False,
         }
         newCombined = { }
         mergePlist(oldCalDAV, oldCardDAV, newCombined)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120315/b2a23904/attachment.html>


More information about the calendarserver-changes mailing list