[CalendarServer-changes] [11893] CalendarServer/branches/users/cdaboo/reverse-proxy-pods
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:17:12 PDT 2014
Revision: 11893
http://trac.calendarserver.org//changeset/11893
Author: cdaboo at apple.com
Date: 2013-11-06 14:17:27 -0800 (Wed, 06 Nov 2013)
Log Message:
-----------
Add podding configuration. Add a new ImportConfig option to config files to allow bottom-up inclusion of other configs,
rather than the top-down approach that IncludeFiles uses.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tap/caldav.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers-test.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/scheduler.py
Added Paths:
-----------
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/accounts-test-pod.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments-test-pod.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/proxies-test-pod.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/resources-test-pod.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podA.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podB.plist
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tap/caldav.py 2013-11-06 21:20:52 UTC (rev 11892)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tap/caldav.py 2013-11-06 22:17:27 UTC (rev 11893)
@@ -402,6 +402,8 @@
config.load(self["config"])
+ for path in config.getProvider().importedFiles:
+ print("Imported configuration from file: '%s'" % (path,))
for path in config.getProvider().includedFiles:
print("Adding configuration from file: '%s'" % (path,))
for path in config.getProvider().missingFiles:
Added: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/accounts-test-pod.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/accounts-test-pod.xml (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/accounts-test-pod.xml 2013-11-06 22:17:27 UTC (rev 11893)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<accounts realm="Test Realm">
+ <user>
+ <uid>admin</uid>
+ <guid>admin</guid>
+ <password>admin</password>
+ <name>Super User</name>
+ <first-name>Super</first-name>
+ <last-name>User</last-name>
+ </user>
+ <user repeat="101">
+ <uid>user%02d</uid>
+ <uid>User %02d</uid>
+ <guid>user%02d</guid>
+ <password>user%02d</password>
+ <name>User %02d</name>
+ <first-name>User</first-name>
+ <last-name>%02d</last-name>
+ <email-address>user%02d at example.com</email-address>
+ </user>
+ <user repeat="101">
+ <uid>puser%02d</uid>
+ <uid>Puser %02d</uid>
+ <guid>puser%02d</guid>
+ <password>puser%02d</password>
+ <name>Puser %02d</name>
+ <first-name>Puser</first-name>
+ <last-name>%02d</last-name>
+ <email-address>puser%02d at example.com</email-address>
+ </user>
+</accounts>
Property changes on: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/accounts-test-pod.xml
___________________________________________________________________
Added: svn:executable
+ *
Added: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments-test-pod.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments-test-pod.xml (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments-test-pod.xml 2013-11-06 22:17:27 UTC (rev 11893)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE augments SYSTEM "augments.dtd">
+
+<augments>
+ <record>
+ <uid>Default</uid>
+ <enable>true</enable>
+ <server-id>A</server-id>
+ <enable-calendar>true</enable-calendar>
+ <enable-addressbook>true</enable-addressbook>
+ </record>
+ <record repeat="101">
+ <uid>puser%02d</uid>
+ <enable>true</enable>
+ <server-id>B</server-id>
+ <enable-calendar>true</enable-calendar>
+ <enable-addressbook>true</enable-addressbook>
+ </record>
+</augments>
Added: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/proxies-test-pod.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/proxies-test-pod.xml (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/proxies-test-pod.xml 2013-11-06 22:17:27 UTC (rev 11893)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2009-2013 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.
+ -->
+
+<!DOCTYPE proxies SYSTEM "proxies.dtd">
+
+<proxies>
+</proxies>
Added: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/resources-test-pod.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/resources-test-pod.xml (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/resources-test-pod.xml 2013-11-06 22:17:27 UTC (rev 11893)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<accounts realm="Test Realm">
+</accounts>
Property changes on: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/resources-test-pod.xml
___________________________________________________________________
Added: svn:executable
+ *
Added: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podA.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podA.plist (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podA.plist 2013-11-06 22:17:27 UTC (rev 11893)
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006-2009 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.
+ -->
+
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+
+ <!-- Import a parent config before this one -->
+ <key>ImportConfig</key>
+ <string>./conf/caldavd-test.plist</string>
+
+ <!-- HTTP port [0 = disable HTTP] -->
+ <key>HTTPPort</key>
+ <integer>8008</integer>
+
+ <!-- SSL port [0 = disable HTTPS] -->
+ <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
+ <key>SSLPort</key>
+ <integer>8443</integer>
+
+ <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
+ <key>BindHTTPPorts</key>
+ <array>
+ </array>
+
+ <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
+ <key>BindSSLPorts</key>
+ <array>
+ </array>
+
+ <!-- Server root -->
+ <key>ServerRoot</key>
+ <string>./data/podA</string>
+
+ <!-- Configuration root -->
+ <key>ConfigRoot</key>
+ <string>./conf</string>
+
+ <!-- XML File Directory Service -->
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>./conf/auth/accounts-test-pod.xml</string>
+ </dict>
+ </dict>
+
+ <!-- Resource and Location Service -->
+ <key>ResourceService</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>type</key>
+ <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>./conf/auth/resources-test-pod.xml</string>
+ </dict>
+ </dict>
+
+ <!-- XML File Augment Service -->
+ <key>AugmentService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFiles</key>
+ <array>
+ <string>./conf/auth/augments-test-pod.xml</string>
+ </array>
+ </dict>
+ </dict>
+
+ <key>ProxyLoadFromFile</key>
+ <string>./conf/auth/proxies-test-pod.xml</string>
+
+ <!-- Servers -->
+ <key>Servers</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>ConfigFile</key>
+ <string>./conf/localservers-test.xml</string>
+ <key>MaxClients</key>
+ <integer>5</integer>
+ <key>InboxName</key>
+ <string>podding</string>
+ </dict>
+
+ <!-- Support for Memcached -->
+ <key>Memcached</key>
+ <dict>
+ <key>Pools</key>
+ <dict>
+ <key>Default</key>
+ <dict>
+ <key>ClientEnabled</key>
+ <true/>
+ <key>ServerEnabled</key>
+ <true/>
+ <key>BindAddress</key>
+ <string>localhost</string>
+ <key>Port</key>
+ <integer>11211</integer>
+ </dict>
+ <key>ProxyDB</key>
+ <dict>
+ <key>ClientEnabled</key>
+ <true/>
+ <key>ServerEnabled</key>
+ <true/>
+ <key>BindAddress</key>
+ <string>localhost</string>
+ <key>Port</key>
+ <integer>11311</integer>
+ <key>HandleCacheTypes</key>
+ <array>
+ <string>ProxyDB</string>
+ <string>PrincipalToken</string>
+ <string>DIGESTCREDENTIALS</string>
+ </array>
+ </dict>
+ </dict>
+ <key>MaxClients</key>
+ <integer>5</integer>
+ <key>memcached</key>
+ <string>../memcached/_root/bin/memcached</string> <!-- Find in PATH -->
+ <key>Options</key>
+ <array>
+ <!--<string>-vv</string>-->
+ </array>
+ </dict>
+
+ </dict>
+</plist>
Added: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podB.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podB.plist (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-test-podB.plist 2013-11-06 22:17:27 UTC (rev 11893)
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006-2009 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.
+ -->
+
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+
+ <!-- Import a parent config before this one -->
+ <key>ImportConfig</key>
+ <string>./conf/caldavd-test.plist</string>
+
+ <!-- HTTP port [0 = disable HTTP] -->
+ <key>HTTPPort</key>
+ <integer>8108</integer>
+
+ <!-- SSL port [0 = disable HTTPS] -->
+ <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
+ <key>SSLPort</key>
+ <integer>8543</integer>
+
+ <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
+ <key>BindHTTPPorts</key>
+ <array>
+ </array>
+
+ <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
+ <key>BindSSLPorts</key>
+ <array>
+ </array>
+
+ <!-- Server root -->
+ <key>ServerRoot</key>
+ <string>./data/podB</string>
+
+ <!-- Configuration root -->
+ <key>ConfigRoot</key>
+ <string>./conf</string>
+
+ <!-- XML File Directory Service -->
+ <key>DirectoryService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>./conf/auth/accounts-test-pod.xml</string>
+ </dict>
+ </dict>
+
+ <!-- Resource and Location Service -->
+ <key>ResourceService</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>type</key>
+ <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFile</key>
+ <string>./conf/auth/resources-test-pod.xml</string>
+ </dict>
+ </dict>
+
+ <!-- XML File Augment Service -->
+ <key>AugmentService</key>
+ <dict>
+ <key>type</key>
+ <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+
+ <key>params</key>
+ <dict>
+ <key>xmlFiles</key>
+ <array>
+ <string>./conf/auth/augments-test-pod.xml</string>
+ </array>
+ </dict>
+ </dict>
+
+ <key>ProxyLoadFromFile</key>
+ <string>./conf/auth/proxies-test-pod.xml</string>
+
+ <!-- Servers -->
+ <key>Servers</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ <key>ConfigFile</key>
+ <string>./conf/localservers-test.xml</string>
+ <key>MaxClients</key>
+ <integer>5</integer>
+ <key>InboxName</key>
+ <string>podding</string>
+ </dict>
+
+ <!-- Support for Memcached -->
+ <key>Memcached</key>
+ <dict>
+ <key>Pools</key>
+ <dict>
+ <key>Default</key>
+ <dict>
+ <key>ClientEnabled</key>
+ <true/>
+ <key>ServerEnabled</key>
+ <true/>
+ <key>BindAddress</key>
+ <string>localhost</string>
+ <key>Port</key>
+ <integer>11411</integer>
+ </dict>
+ <key>ProxyDB</key>
+ <dict>
+ <key>ClientEnabled</key>
+ <true/>
+ <key>ServerEnabled</key>
+ <true/>
+ <key>BindAddress</key>
+ <string>localhost</string>
+ <key>Port</key>
+ <integer>11311</integer>
+ <key>HandleCacheTypes</key>
+ <array>
+ <string>ProxyDB</string>
+ <string>PrincipalToken</string>
+ <string>DIGESTCREDENTIALS</string>
+ </array>
+ </dict>
+ </dict>
+ <key>MaxClients</key>
+ <integer>5</integer>
+ <key>memcached</key>
+ <string>../memcached/_root/bin/memcached</string> <!-- Find in PATH -->
+ <key>Options</key>
+ <array>
+ <!--<string>-vv</string>-->
+ </array>
+ </dict>
+
+ </dict>
+</plist>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers-test.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers-test.xml 2013-11-06 21:20:52 UTC (rev 11892)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers-test.xml 2013-11-06 22:17:27 UTC (rev 11893)
@@ -20,7 +20,15 @@
<servers>
<server>
- <id>00001</id>
+ <id>A</id>
<uri>http://localhost:8008</uri>
+ <allowed-from>localhost</allowed-from>
+ <shared-secret>A</shared-secret>
</server>
+ <server>
+ <id>B</id>
+ <uri>http://localhost:8108</uri>
+ <allowed-from>localhost</allowed-from>
+ <shared-secret>B</shared-secret>
+ </server>
</servers>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py 2013-11-06 21:20:52 UTC (rev 11892)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py 2013-11-06 22:17:27 UTC (rev 11893)
@@ -97,6 +97,7 @@
self._defaults = ConfigDict()
else:
self._defaults = ConfigDict(copy.deepcopy(defaults))
+ self.importedFiles = []
self.includedFiles = []
self.missingFiles = []
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py 2013-11-06 21:20:52 UTC (rev 11892)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py 2013-11-06 22:17:27 UTC (rev 11893)
@@ -1010,7 +1010,8 @@
# means no automatic shutdown.
"AgentInactivityTimeoutSeconds" : 4 * 60 * 60,
- # These two aren't relative to ConfigRoot:
+ # These aren't relative to ConfigRoot:
+ "ImportConfig": "", # Config to read first and merge
"Includes": [], # Other plists to parse after this one
"WritableConfigFile" : "", # which config file calendarserver_config should
# write to for changes; empty string means the main config file.
@@ -1043,6 +1044,22 @@
configDict = self._parseConfigFromFile(self._configFileName)
configDict = ConfigDict(configDict)
+ def _loadImport(childDict):
+ # Look for an import and read that one as the main config and merge the current one into that
+ if "ImportConfig" in childDict and childDict.ImportConfig:
+ configRoot = os.path.join(childDict.ServerRoot, childDict.ConfigRoot)
+ path = _expandPath(fullServerPath(configRoot, childDict.ImportConfig))
+ if os.path.exists(path):
+ importDict = ConfigDict(self._parseConfigFromFile(path))
+ if importDict:
+ self.importedFiles.append(path)
+ importDict = _loadImport(importDict)
+ mergeData(importDict, childDict)
+ return importDict
+ raise ConfigurationError("Import configuration file '{path}' must exist and be valid.".format(path=path))
+ else:
+ return childDict
+
def _loadIncludes(parentDict):
# Now check for Includes and parse and add each of those
if "Includes" in parentDict:
@@ -1059,6 +1076,7 @@
else:
self.missingFiles.append(path)
+ configDict = _loadImport(configDict)
_loadIncludes(configDict)
return configDict
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/scheduler.py 2013-11-06 21:20:52 UTC (rev 11892)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/scheduler.py 2013-11-06 22:17:27 UTC (rev 11893)
@@ -102,7 +102,7 @@
))
else:
if not (originatorPrincipal.calendarsEnabled() and originatorPrincipal.thisServer()):
- log.err("Originator not enabled or hosted on this server: %s" % (self.originator,))
+ log.error("Originator not enabled or hosted on this server: %s" % (self.originator,))
raise HTTPError(self.errorResponse(
responsecode.FORBIDDEN,
self.errorElements["originator-denied"],
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/96c7194b/attachment.html>
More information about the calendarserver-changes
mailing list