[CalendarServer-changes] [15409] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 21 13:27:08 PST 2015


Revision: 15409
          http://trac.calendarserver.org//changeset/15409
Author:   cdaboo at apple.com
Date:     2015-12-21 13:27:08 -0800 (Mon, 21 Dec 2015)
Log Message:
-----------
Config clean-up.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/test/deprovision/caldavd.plist
    CalendarServer/trunk/calendarserver/tools/test/gateway/caldavd.plist
    CalendarServer/trunk/calendarserver/tools/test/principals/caldavd.plist
    CalendarServer/trunk/conf/caldavd-apple.plist
    CalendarServer/trunk/conf/caldavd-stdconfig.plist
    CalendarServer/trunk/conf/caldavd-test-podA.plist
    CalendarServer/trunk/conf/caldavd-test-podB.plist
    CalendarServer/trunk/conf/caldavd-test-s2s.plist
    CalendarServer/trunk/conf/caldavd-test.plist
    CalendarServer/trunk/conf/caldavd.plist
    CalendarServer/trunk/conf/resources/caldavd-resources.plist
    CalendarServer/trunk/twistedcaldav/dumpconfig.py
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/twistedcaldav/test/test_dumpconfig.py
    CalendarServer/trunk/twistedcaldav/upgrade.py
    CalendarServer/trunk/txdav/common/datastore/test/util.py
    CalendarServer/trunk/txdav/who/test/test_util.py
    CalendarServer/trunk/txdav/who/util.py

Modified: CalendarServer/trunk/calendarserver/tools/test/deprovision/caldavd.plist
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/deprovision/caldavd.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/calendarserver/tools/test/deprovision/caldavd.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -128,7 +128,7 @@
     <key>DirectoryService</key>
     <dict>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -148,7 +148,7 @@
       <key>Enabled</key>
       <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -162,24 +162,7 @@
       </dict>
     </dict>
 
-    <!-- Open Directory Service (Mac OS X) -->
     <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--
         Augment service
 
         Augments for the directory service records to add calendar specific attributes.
@@ -190,8 +173,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -202,38 +187,6 @@
       </dict>
     </dict>
 
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
     <!-- Sqlite ProxyDB Service -->
     <key>ProxyDBService</key>
     <dict>

Modified: CalendarServer/trunk/calendarserver/tools/test/gateway/caldavd.plist
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/gateway/caldavd.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/calendarserver/tools/test/gateway/caldavd.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -140,7 +140,7 @@
     <key>DirectoryService</key>
     <dict>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -160,7 +160,7 @@
       <key>Enabled</key>
       <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -175,24 +175,7 @@
       </dict>
     </dict>
 
-    <!-- Open Directory Service (Mac OS X) -->
     <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--
         Augment service
 
         Augments for the directory service records to add calendar specific attributes.
@@ -203,8 +186,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -215,38 +200,6 @@
       </dict>
     </dict>
 
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
     <!-- Sqlite ProxyDB Service -->
     <key>ProxyDBService</key>
     <dict>

Modified: CalendarServer/trunk/calendarserver/tools/test/principals/caldavd.plist
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/principals/caldavd.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/calendarserver/tools/test/principals/caldavd.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -132,7 +132,7 @@
     <key>DirectoryService</key>
     <dict>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -152,7 +152,7 @@
       <key>Enabled</key>
       <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -167,24 +167,7 @@
       </dict>
     </dict>
 
-    <!-- Open Directory Service (Mac OS X) -->
     <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--
         Augment service
 
         Augments for the directory service records to add calendar specific attributes.
@@ -195,8 +178,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -207,38 +192,6 @@
       </dict>
     </dict>
 
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
     <!-- Sqlite ProxyDB Service -->
     <key>ProxyDBService</key>
     <dict>

Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/caldavd-apple.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -543,8 +543,10 @@
     <!-- Directory searching -->
     <key>DirectoryAddressBook</key>
     <dict>
-	    <key>Enabled</key>
-	    <true/>
+	  <key>Enabled</key>
+	  <true/>
+	  <key>type</key>
+	  <string>opendirectory</string>
       <key>params</key>
       <dict>
         <key>queryUserRecords</key>

Modified: CalendarServer/trunk/conf/caldavd-stdconfig.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-stdconfig.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/caldavd-stdconfig.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 
 <!--
     Copyright (c) 2006-2015 Apple Inc. All rights reserved.
@@ -16,7 +17,6 @@
     limitations under the License.
   -->
 
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
 	<!-- Public network address information
@@ -405,8 +405,11 @@
 
 	<key>AugmentService</key>
 	<dict>
+		<key>Enabled</key>
+		<true/>
+
 		<key>type</key>
-		<string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+		<string>xml</string>
 
 		<key>params</key>
 		<dict>
@@ -1075,7 +1078,7 @@
 		<true/>
 
 		<key>type</key>
-		<string>twistedcaldav.directory.opendirectorybacker.OpenDirectoryBackingService</string>
+		<string>opendirectory</string>
 
 		<key>params</key>
 		<dict>

Modified: CalendarServer/trunk/conf/caldavd-test-podA.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test-podA.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/caldavd-test-podA.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -82,8 +82,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
       
       <key>params</key>
       <dict>

Modified: CalendarServer/trunk/conf/caldavd-test-podB.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test-podB.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/caldavd-test-podB.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -82,8 +82,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
       
       <key>params</key>
       <dict>

Modified: CalendarServer/trunk/conf/caldavd-test-s2s.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test-s2s.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/caldavd-test-s2s.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -55,7 +55,7 @@
     <key>DirectoryService</key>
     <dict>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
       
       <key>params</key>
       <dict>
@@ -70,7 +70,7 @@
       <key>Enabled</key>
       <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
       
       <key>params</key>
       <dict>
@@ -82,8 +82,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
       
       <key>params</key>
       <dict>

Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/caldavd-test.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -329,8 +329,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -341,38 +343,6 @@
       </dict>
     </dict>
 
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>./conf/auth/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
     <key>ProxyLoadFromFile</key>
     <string>./conf/auth/proxies-test.xml</string>
 

Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/caldavd.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -177,7 +177,7 @@
     <key>DirectoryService</key>
     <dict>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
       
       <key>params</key>
       <dict>
@@ -185,23 +185,6 @@
         <string>accounts.xml</string>
       </dict>
     </dict>
-    
-    <!-- Open Directory Service (Mac OS X) -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-     -->
 
 
     <!--

Modified: CalendarServer/trunk/conf/resources/caldavd-resources.plist
===================================================================
--- CalendarServer/trunk/conf/resources/caldavd-resources.plist	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/conf/resources/caldavd-resources.plist	2015-12-21 21:27:08 UTC (rev 15409)
@@ -112,7 +112,7 @@
     <key>DirectoryService</key>
     <dict>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -131,7 +131,7 @@
       <key>Enabled</key>
       <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -145,24 +145,7 @@
       </dict>
     </dict>
 
-    <!-- Open Directory Service (Mac OS X) -->
     <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--
         Augment service
 
         Augments for the directory service records to add calendar specific attributes.
@@ -173,8 +156,10 @@
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
+      <key>Enabled</key>
+      <true/>
       <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      <string>xml</string>
 
       <key>params</key>
       <dict>
@@ -185,38 +170,6 @@
       </dict>
     </dict>
 
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
     <!-- Sqlite ProxyDB Service -->
     <key>ProxyDBService</key>
     <dict>

Modified: CalendarServer/trunk/twistedcaldav/dumpconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dumpconfig.py	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/twistedcaldav/dumpconfig.py	2015-12-21 21:27:08 UTC (rev 15409)
@@ -23,6 +23,25 @@
 import re
 import textwrap
 
+COPYRIGHT = """
+<!--
+    Copyright (c) 2006-2015 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.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+  -->
+"""
+
+
 def parseConfigItem(item):
     """
     Read the definition of a "DEFAULT_*" value from the stdconfig.py file so that we get
@@ -244,6 +263,7 @@
         pathOrFile = open(pathOrFile, "w")
         didOpen = 1
     writer = OrderedPlistWriter(pathOrFile)
+    writer.writeln(COPYRIGHT)
     writer.writeln("<plist version=\"1.0\">")
     writer.writeValue(rootObject)
     writer.writeln("</plist>")
@@ -264,8 +284,26 @@
     writeOrderedPlist(rootObject, f)
     return f.getvalue()
 
-if __name__ == '__main__':
 
+
+def writeStdConfig(data):
+    """
+    Write the actual plist data to conf/caldavd-stdconfig.plist.
+
+    @param data: plist data
+    @type data: L{str}
+    """
+
+    with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "conf", "caldavd-stdconfig.plist"), "w") as f:
+        f.write(data)
+
+
+
+def dumpConfig():
+    """
+    Dump the full stdconfig to a string.
+    """
+
     # Generate a set of serialized JSON objects for the *_PARAMS config items
     maps = {
         "DEFAULT_SERVICE_PARAMS": "",
@@ -281,4 +319,11 @@
     # Generate the plist for the default config, substituting for the *_PARAMS items
     lines = parseConfigItem("DEFAULT_CONFIG")
     j = processConfig(lines, with_comments=True, verbose=False, substitutions=maps)
-    print(writeOrderedPlistToString(j))
+    return writeOrderedPlistToString(j)
+
+
+if __name__ == '__main__':
+
+    data = dumpConfig()
+    writeStdConfig(data)
+    print(data)

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2015-12-21 21:27:08 UTC (rev 15409)
@@ -116,27 +116,15 @@
 }
 
 DEFAULT_AUGMENT_PARAMS = {
-    "twistedcaldav.directory.augment.AugmentXMLDB": {
+    "xml": {
         "xmlFiles": ["augments.xml"],
         "statSeconds": 15,
     },
-    "twistedcaldav.directory.augment.AugmentSqliteDB": {
-        "dbpath": "augments.sqlite",
-    },
-    "twistedcaldav.directory.augment.AugmentPostgreSQLDB": {
-        "host": "localhost",
-        "database": "augments",
-        "user": "",
-        "password": "",
-    },
 }
 
 
 DEFAULT_DIRECTORY_ADDRESSBOOK_PARAMS = {
-    "twistedcaldav.directory.xmlfile.XMLDirectoryService": {
-        "xmlFile": "/etc/carddavd/accounts.xml",
-    },
-    "twistedcaldav.directory.opendirectorybacker.OpenDirectoryBackingService": {
+    "opendirectory": {
         "queryPeopleRecords": True,
         "peopleNode": "/Search/Contacts",
         "queryUserRecords": True,
@@ -354,8 +342,9 @@
     #    Augments for the directory service records to add calendar specific attributes.
     #
     "AugmentService": {
-        "type": "twistedcaldav.directory.augment.AugmentXMLDB",
-        "params": DEFAULT_AUGMENT_PARAMS["twistedcaldav.directory.augment.AugmentXMLDB"],
+        "Enabled": True,
+        "type": "xml",
+        "params": DEFAULT_AUGMENT_PARAMS["xml"],
     },
 
     #
@@ -661,8 +650,8 @@
     # CardDAV Features
     "DirectoryAddressBook": {
         "Enabled": True,
-        "type": "twistedcaldav.directory.opendirectorybacker.OpenDirectoryBackingService",
-        "params": DEFAULT_DIRECTORY_ADDRESSBOOK_PARAMS["twistedcaldav.directory.opendirectorybacker.OpenDirectoryBackingService"],
+        "type": "opendirectory",
+        "params": DEFAULT_DIRECTORY_ADDRESSBOOK_PARAMS["opendirectory"],
         "name": "directory",
         "MaxQueryResults": 1000,
     },
@@ -1500,21 +1489,22 @@
 
 
 def _postUpdateAugmentService(configDict, reloading=False):
-    if configDict.AugmentService.type in DEFAULT_AUGMENT_PARAMS:
-        for param in tuple(configDict.AugmentService.params):
-            if param not in DEFAULT_AUGMENT_PARAMS[configDict.AugmentService.type]:
-                log.warn("Parameter {p} is not supported by service {t}", p=param, t=configDict.AugmentService.type)
-                del configDict.AugmentService.params[param]
+    if configDict.AugmentService.Enabled:
+        if configDict.AugmentService.type in DEFAULT_AUGMENT_PARAMS:
+            for param in tuple(configDict.AugmentService.params):
+                if param not in DEFAULT_AUGMENT_PARAMS[configDict.AugmentService.type]:
+                    log.warn("Parameter {p} is not supported by service {t}", p=param, t=configDict.AugmentService.type)
+                    del configDict.AugmentService.params[param]
 
-    # Upgrading augments.xml must be done prior to using the store/directory
-    if configDict.AugmentService.type == "twistedcaldav.directory.augment.AugmentXMLDB":
-        for fileName in configDict.AugmentService.params.xmlFiles:
-            if fileName[0] not in ("/", "."):
-                fileName = os.path.join(configDict.DataRoot, fileName)
-            filePath = FilePath(fileName)
-            if filePath.exists():
-                from twistedcaldav.upgrade import upgradeAugmentsXML
-                upgradeAugmentsXML(filePath)
+        # Upgrading augments.xml must be done prior to using the store/directory
+        if configDict.AugmentService.type == "xml":
+            for fileName in configDict.AugmentService.params.xmlFiles:
+                if fileName[0] not in ("/", "."):
+                    fileName = os.path.join(configDict.DataRoot, fileName)
+                filePath = FilePath(fileName)
+                if filePath.exists():
+                    from twistedcaldav.upgrade import upgradeAugmentsXML
+                    upgradeAugmentsXML(filePath)
 
 
 

Modified: CalendarServer/trunk/twistedcaldav/test/test_dumpconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_dumpconfig.py	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/twistedcaldav/test/test_dumpconfig.py	2015-12-21 21:27:08 UTC (rev 15409)
@@ -14,10 +14,12 @@
 # limitations under the License.
 ##
 
-from unittest.case import TestCase
-from twistedcaldav.dumpconfig import parseConfigItem, processConfig, \
-    writeOrderedPlistToString
 from collections import OrderedDict
+from difflib import unified_diff
+from twistedcaldav.dumpconfig import parseConfigItem, dumpConfig, \
+    writeOrderedPlistToString, COPYRIGHT
+from unittest.case import TestCase
+import os
 
 class TestDumpConfig (TestCase):
 
@@ -54,6 +56,7 @@
         plist = writeOrderedPlistToString(data)
         self.assertEqual(plist, """<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+{copyright}
 <plist version="1.0">
 <dict>
 \t<key>KeyB</key>
@@ -72,7 +75,7 @@
 \t<string>5</string>
 </dict>
 </plist>
-""")
+""".format(copyright=COPYRIGHT))
 
 
     def test_plistWithComments(self):
@@ -92,6 +95,7 @@
         plist = writeOrderedPlistToString(data)
         self.assertEqual(plist, """<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+{copyright}
 <plist version="1.0">
 <dict>
 \t<!-- All about KeyB -->
@@ -109,7 +113,7 @@
 \t<string>3</string>
 </dict>
 </plist>
-""")
+""".format(copyright=COPYRIGHT))
 
 
     def test_fullPlistDump(self):
@@ -117,19 +121,10 @@
         Make sure a full dump of DEFAULT_CONFIG works
         """
 
-        maps = {
-            "DEFAULT_SERVICE_PARAMS": "",
-            "DEFAULT_RESOURCE_PARAMS": "",
-            "DEFAULT_AUGMENT_PARAMS": "",
-            "DEFAULT_DIRECTORY_ADDRESSBOOK_PARAMS": "",
-        }
-
-        for item in maps.keys():
-            lines = parseConfigItem(item)
-            maps[item] = processConfig(lines, with_comments=True, verbose=False)
-
-        # Generate the plist for the default config, substituting for the *_PARAMS items
-        lines = parseConfigItem("DEFAULT_CONFIG")
-        j = processConfig(lines, with_comments=True, verbose=False, substitutions=maps)
-        result = writeOrderedPlistToString(j)
+        result = dumpConfig()
         self.assertIn('<plist version="1.0">', result)
+
+        # Check that caldavd-stdconfig.plist matches
+        with open(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "conf", "caldavd-stdconfig.plist")) as f:
+            actual = f.read()
+        self.assertEqual(result, actual, msg="\n".join(unified_diff(result.splitlines(), actual.splitlines())))

Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py	2015-12-21 21:27:08 UTC (rev 15409)
@@ -991,8 +991,11 @@
     # Fetch the autoSchedule assignments from resourceinfo.sqlite and store
     # the values in augments
     augmentService = None
-    if config.AugmentService.type:
-        augmentClass = namedClass(config.AugmentService.type)
+    if config.AugmentService.Enabled:
+        serviceClass = {
+            "xml": "twistedcaldav.directory.augment.AugmentXMLDB",
+        }
+        augmentClass = namedClass(serviceClass[config.AugmentService.type])
         try:
             augmentService = augmentClass(**config.AugmentService.params)
         except:

Modified: CalendarServer/trunk/txdav/common/datastore/test/util.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/util.py	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/txdav/common/datastore/test/util.py	2015-12-21 21:27:08 UTC (rev 15409)
@@ -753,7 +753,8 @@
     )
     augmentServiceInfo = ConfigDict(
         {
-            "type": "twistedcaldav.directory.augment.AugmentXMLDB",
+            "Enabled": True,
+            "type": "xml",
             "params": {
                 "xmlFiles": ["augments.xml", ],
                 "statSeconds": 15,

Modified: CalendarServer/trunk/txdav/who/test/test_util.py
===================================================================
--- CalendarServer/trunk/txdav/who/test/test_util.py	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/txdav/who/test/test_util.py	2015-12-21 21:27:08 UTC (rev 15409)
@@ -84,7 +84,7 @@
                 },
                 "DirectoryService": {
                     "Enabled": True,
-                    "type": "XML",
+                    "type": "xml",
                     "params": {
                         "xmlFile": "accounts.xml",
                         "recordTypes": ["users", "groups"],
@@ -92,7 +92,7 @@
                 },
                 "ResourceService": {
                     "Enabled": True,
-                    "type": "XML",
+                    "type": "xml",
                     "params": {
                         "xmlFile": "resources.xml",
                         "recordTypes": ["locations", "resources", "addresses"],
@@ -100,8 +100,7 @@
                 },
                 "AugmentService": {
                     "Enabled": True,
-                    # FIXME: This still uses an actual class name:
-                    "type": "twistedcaldav.directory.augment.AugmentXMLDB",
+                    "type": "xml",
                     "params": {
                         "xmlFiles": ["augments.xml"],
                     },

Modified: CalendarServer/trunk/txdav/who/util.py
===================================================================
--- CalendarServer/trunk/txdav/who/util.py	2015-12-19 15:01:41 UTC (rev 15408)
+++ CalendarServer/trunk/txdav/who/util.py	2015-12-21 21:27:08 UTC (rev 15409)
@@ -240,14 +240,18 @@
     #
     # Setup the Augment Service
     #
-    if augmentServiceInfo.type:
+    if augmentServiceInfo.Enabled:
+        serviceClass = {
+            "xml": "twistedcaldav.directory.augment.AugmentXMLDB",
+        }
+
         for augmentFile in augmentServiceInfo.params.xmlFiles:
             augmentFile = fullServerPath(dataRoot, augmentFile)
             augmentFilePath = FilePath(augmentFile)
             if not augmentFilePath.exists():
                 augmentFilePath.setContent(DEFAULT_AUGMENT_CONTENT)
 
-        augmentClass = namedClass(augmentServiceInfo.type)
+        augmentClass = namedClass(serviceClass[augmentServiceInfo.type])
         log.info(
             "Configuring augment service of type: {augmentClass}",
             augmentClass=augmentClass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151221/b62b1f80/attachment-0001.html>


More information about the calendarserver-changes mailing list