[CalendarServer-changes] [14734] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri May 1 15:32:01 PDT 2015


Revision: 14734
          http://trac.calendarserver.org//changeset/14734
Author:   sagen at apple.com
Date:     2015-05-01 15:32:00 -0700 (Fri, 01 May 2015)
Log Message:
-----------
Use new APNS cert alert; return ServerRoot key from calendarserver_config (but it's read only)

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/util.py
    CalendarServer/trunk/calendarserver/tools/config.py
    CalendarServer/trunk/calendarserver/tools/test/test_config.py
    CalendarServer/trunk/conf/caldavd-apple.plist

Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py	2015-05-01 20:01:24 UTC (rev 14733)
+++ CalendarServer/trunk/calendarserver/tap/util.py	2015-05-01 22:32:00 UTC (rev 14734)
@@ -1328,6 +1328,7 @@
                         cert=protoConfig.CertificatePath
                     )
                 )
+                postAlert("PushNotificationCertificateAlert", [])
                 return False, message
 
             try:
@@ -1351,6 +1352,7 @@
                         reason=str(e)
                     )
                 )
+                postAlert("PushNotificationCertificateAlert", [])
                 return False, message
 
         return True, "APNS enabled"

Modified: CalendarServer/trunk/calendarserver/tools/config.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/config.py	2015-05-01 20:01:24 UTC (rev 14733)
+++ CalendarServer/trunk/calendarserver/tools/config.py	2015-05-01 22:32:00 UTC (rev 14734)
@@ -29,6 +29,7 @@
 """
 
 from getopt import getopt, GetoptError
+from itertools import chain
 import os
 import plistlib
 import signal
@@ -84,6 +85,9 @@
     "SSLPrivateKey",
 ]
 
+READONLY_CONFIG_KEYS = [
+    "ServerRoot",
+]
 
 
 
@@ -351,7 +355,7 @@
         @type command: C{dict}
         """
         result = {}
-        for keyPath in WRITABLE_CONFIG_KEYS:
+        for keyPath in chain(WRITABLE_CONFIG_KEYS, READONLY_CONFIG_KEYS):
             value = getKeyPath(config, keyPath)
             if value is not None:
                 # Note: config contains utf-8 encoded strings, but plistlib

Modified: CalendarServer/trunk/calendarserver/tools/test/test_config.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_config.py	2015-05-01 20:01:24 UTC (rev 14733)
+++ CalendarServer/trunk/calendarserver/tools/test/test_config.py	2015-05-01 22:32:00 UTC (rev 14734)
@@ -133,8 +133,8 @@
         self.assertEquals(results["result"]["Notifications"]["Services"]["APNS"]["Enabled"], False)
         self.assertEquals(results["result"]["Notifications"]["Services"]["APNS"]["CalDAV"]["CertificatePath"], "/example/calendar.cer")
 
-        # Verify not all keys are present, such as ServerRoot which is not writable
-        self.assertFalse("ServerRoot" in results["result"])
+        # Verify not all keys are present, such as umask which is not accessible
+        self.assertFalse("umask" in results["result"])
 
 
     @inlineCallbacks
@@ -154,6 +154,9 @@
         hostName = "hostname_%s_%s" % (unichr(208), u"\ud83d\udca3")
         self.assertTrue(results["result"]["ServerHostName"].endswith(hostName))
 
+        # We tried to modify ServerRoot, but make sure our change did not take
+        self.assertNotEquals(results["result"]["ServerRoot"], "/You/Shall/Not/Pass")
+
         # The static plist should still have EnableCalDAV = True
         staticPlist = plistlib.readPlist(self.configFileName)
         self.assertTrue(staticPlist["EnableCalDAV"])
@@ -241,6 +244,8 @@
             <true/>
             <key>Notifications.Services.APNS.CalDAV.CertificatePath</key>
             <string>/example/changed.cer</string>
+            <key>ServerRoot</key>
+            <string>/You/Shall/Not/Pass</string>
             <key>ServerHostName</key>
             <string>hostname_%s_%s</string>
         </dict>

Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist	2015-05-01 20:01:24 UTC (rev 14733)
+++ CalendarServer/trunk/conf/caldavd-apple.plist	2015-05-01 22:32:00 UTC (rev 14734)
@@ -558,7 +558,7 @@
     <!-- Alert-posting program
       -->
     <key>AlertPostingProgram</key>
-    <string>/Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/bin/calendarserver_alert</string>
+    <string>/Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/Setup/CalendarServerAlert</string>
 
     <!-- Includes of other plists
       -->
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150501/4f90ff4f/attachment.html>


More information about the calendarserver-changes mailing list