[CalendarServer-changes] [11890] CalendarServer/branches/users/cdaboo/reverse-proxy-pods
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:24:35 PDT 2014
Revision: 11890
http://trac.calendarserver.org//changeset/11890
Author: cdaboo at apple.com
Date: 2013-11-05 12:05:41 -0800 (Tue, 05 Nov 2013)
Log Message:
-----------
Use HTTP reverse proxy between pods to support cross-pod calendar user proxies. Remove all partitioning logic - now pod only.
Fix some startup logging issues.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/_calendarserver_preamble.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tap/caldav.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/shell/directory.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/deprovision/caldavd.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/gateway/caldavd.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/principals/caldavd.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments.dtd
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers-test.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers-test.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/resources/caldavd-resources.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/contrib/tools/request_monitor.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/setup.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/augment.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/common.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory-principal-resource.html
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/idirectory.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/ldapdirectory.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/principal.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/resource.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test-default.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test.xml
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/resources/caldavd.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_augment.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_ldapdirectory.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/xmlaugmentsparser.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/addressmapping.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/delivery.py
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/cuaddress.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/implicit.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/delivery.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/localservers.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/scheduler.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/test/test_localservers.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/scheduler.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/utils.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/test/util.py
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/icalendardirectoryservice.py
Added Paths:
-----------
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.dtd
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.dtd
Removed Paths:
-------------
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/calendarserver_make_partition
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-primary.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-secondary.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servers.dtd
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servertoserver.dtd
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/sudoers.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers.plist
CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers2.plist
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/_calendarserver_preamble.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/_calendarserver_preamble.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/_calendarserver_preamble.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -60,7 +60,6 @@
noConfigOption = [
"calendarserver_bootstrap_database",
"calendarserver_load_augmentdb",
- "calendarserver_make_partition",
"calendarserver_manage_augments",
"calendarserver_manage_postgres",
"calendarserver_manage_timezones",
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/calendarserver_make_partition
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/calendarserver_make_partition 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/bin/calendarserver_make_partition 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-##
-# Copyright (c) 2010-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.
-##
-
-import sys
-
-#PYTHONPATH
-
-if __name__ == "__main__":
- if "PYTHONPATH" in globals():
- sys.path.insert(0, PYTHONPATH)
- else:
- try:
- import _calendarserver_preamble
- except ImportError:
- sys.exc_clear()
-
- from calendarserver.tools.makepartition import main
- main()
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-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tap/caldav.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -401,6 +401,12 @@
print("Reading configuration from file: %s" % (self["config"],))
config.load(self["config"])
+
+ for path in config.getProvider().includedFiles:
+ print("Adding configuration from file: '%s'" % (path,))
+ for path in config.getProvider().missingFiles:
+ print("Missing configuration file: '%s'" % (path,))
+
config.updateDefaults(self.overrides)
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/shell/directory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/shell/directory.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/shell/directory.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -41,6 +41,7 @@
returnValue(sorted(records, key=operator.attrgetter("fullName")))
+
@inlineCallbacks
def recordInfo(directory, record):
"""
@@ -58,8 +59,9 @@
add("Proxy access" , (yield recordProxyAccessInfo(directory, record)))
returnValue("\n".join(info))
-
+
+
def recordBasicInfo(directory, record):
"""
Basic information for a record.
@@ -87,15 +89,15 @@
for cua in record.calendarUserAddresses:
add("Calendar User Address", cua)
- add("Server ID" , record.serverID )
- add("Partition ID" , record.partitionID )
- add("Enabled" , record.enabled )
- add("Enabled for Calendar", record.enabledForCalendaring )
+ add("Server ID" , record.serverID)
+ add("Enabled" , record.enabled)
+ add("Enabled for Calendar", record.enabledForCalendaring)
add("Enabled for Contacts", record.enabledForAddressBooks)
return succeed(table.toString())
+
def recordGroupMembershipInfo(directory, record):
"""
Group membership info for a record.
@@ -109,7 +111,7 @@
return succeed(None)
rows = sorted(rows,
- key = lambda row: (row[1], row[2])
+ key=lambda row: (row[1], row[2])
)
table = Table()
@@ -120,6 +122,7 @@
return succeed(table.toString())
+
@inlineCallbacks
def recordProxyAccessInfo(directory, record):
"""
@@ -154,7 +157,7 @@
returnValue(None)
rows = sorted(rows,
- key = lambda row: (row[1], row[2], row[4])
+ key=lambda row: (row[1], row[2], row[4])
)
table = Table()
@@ -165,6 +168,7 @@
returnValue(table.toString())
+
def summarizeRecords(directory, records):
table = Table()
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/deprovision/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/deprovision/caldavd.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/deprovision/caldavd.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -191,7 +191,6 @@
Augments for the directory service records to add calendar specific attributes.
A variety of augment services are available for use.
- When using a partitioned server, a service that can be accessed from each host will be needed.
-->
<!-- XML File Augment Service -->
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/gateway/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/gateway/caldavd.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/gateway/caldavd.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -203,7 +203,6 @@
Augments for the directory service records to add calendar specific attributes.
A variety of augment services are available for use.
- When using a partitioned server, a service that can be accessed from each host will be needed.
-->
<!-- XML File Augment Service -->
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/principals/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/principals/caldavd.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/calendarserver/tools/test/principals/caldavd.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -195,7 +195,6 @@
Augments for the directory service records to add calendar specific attributes.
A variety of augment services are available for use.
- When using a partitioned server, a service that can be accessed from each host will be needed.
-->
<!-- XML File Augment Service -->
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments.dtd
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments.dtd 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/auth/augments.dtd 2013-11-05 20:05:41 UTC (rev 11890)
@@ -19,7 +19,7 @@
<!ELEMENT record (
uid,
enable,
- (server-id, partition-id?)?,
+ server-id?,
enable-calendar?,
enable-addressbook?,
enable-login?,
@@ -32,7 +32,6 @@
<!ELEMENT uid (#PCDATA)>
<!ELEMENT enable (#PCDATA)>
<!ELEMENT server-id (#PCDATA)>
- <!ELEMENT partition-id (#PCDATA)>
<!ELEMENT enable-calendar (#PCDATA)>
<!ELEMENT enable-addressbook (#PCDATA)>
<!ELEMENT enable-login (#PCDATA)>
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-primary.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-primary.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-primary.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright (c) 2006-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 plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
-
- <!-- Servers -->
- <key>Servers</key>
- <dict>
- <key>Enabled</key>
- <true/>
- <key>ConfigFile</key>
- <string>localservers.xml</string>
- <key>MaxClients</key>
- <integer>5</integer>
- </dict>
- <key>ServerPartitionID</key>
- <string>00001</string>
-
- <!-- PostgreSQL ProxyDB Service -->
- <key>ProxyDBService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-
- <key>params</key>
- <dict>
- <key>host</key>
- <string>localhost</string>
- <key>database</key>
- <string>proxies</string>
- </dict>
- </dict>
-
- <!-- Support for Memcached -->
- <key>Memcached</key>
- <dict>
- <key>Pools</key>
- <dict>
- <key>CommonToAllNodes</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>
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-secondary.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-secondary.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/caldavd-partitioning-secondary.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright (c) 2006-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 plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
-
- <!-- Servers -->
- <key>Servers</key>
- <dict>
- <key>Enabled</key>
- <true/>
- <key>ConfigFile</key>
- <string>localservers.xml</string>
- <key>MaxClients</key>
- <integer>5</integer>
- </dict>
- <key>ServerPartitionID</key>
- <string>00002</string>
-
- <!-- PostgreSQL ProxyDB Service -->
- <key>ProxyDBService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-
- <key>params</key>
- <dict>
- <key>host</key>
- <string>localhost</string>
- <key>database</key>
- <string>proxies</string>
- </dict>
- </dict>
-
- <!-- Support for Memcached -->
- <key>Memcached</key>
- <dict>
- <key>Pools</key>
- <dict>
- <key>CommonToAllNodes</key>
- <dict>
- <key>ClientEnabled</key>
- <true/>
- <key>ServerEnabled</key>
- <false/>
- <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-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers-test.xml 2013-11-05 20:05:41 UTC (rev 11890)
@@ -16,21 +16,11 @@
limitations under the License.
-->
-<!DOCTYPE servers SYSTEM "servers.dtd">
+<!DOCTYPE servers SYSTEM "localservers.dtd">
<servers>
<server>
<id>00001</id>
<uri>http://localhost:8008</uri>
- <partitions>
- <partition>
- <id>00001</id>
- <uri>http://localhost:8008</uri>
- </partition>
- <partition>
- <id>00002</id>
- <uri>http://localhost:8108</uri>
- </partition>
- </partitions>
</server>
</servers>
Copied: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.dtd (from rev 11875, CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servers.dtd)
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.dtd (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.dtd 2013-11-05 20:05:41 UTC (rev 11890)
@@ -0,0 +1,25 @@
+<!--
+Copyright (c) 2011-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.
+-->
+
+<!ELEMENT servers (server*) >
+
+ <!ELEMENT server (id, uri, allowed-from*, shared-secret?) >
+ <!ATTLIST server implicit (yes|no) "yes">
+
+ <!ELEMENT id (#PCDATA) >
+ <!ELEMENT uri (#PCDATA) >
+ <!ELEMENT allowed-from (#PCDATA) >
+ <!ELEMENT shared-secret (#PCDATA) >
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.xml 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/localservers.xml 2013-11-05 20:05:41 UTC (rev 11890)
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<!DOCTYPE servers SYSTEM "servers.dtd">
+<!DOCTYPE servers SYSTEM "localservers.dtd">
<servers>
<!--
@@ -30,16 +30,6 @@
<allowed-from>127.0.0.1</allowed-from>
<allowed-from>example.local</allowed-from>
<shared-secret>ABC</shared-secret>
- <partitions>
- <partition>
- <id>00001</id>
- <url>https://machine1.example.com:8443</url>
- </partition>
- <partition>
- <id>00002</id>
- <url>https://machine2.example.com:8443</url>
- </partition>
- </partitions>
</server>
-->
</servers>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers-test.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers-test.xml 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers-test.xml 2013-11-05 20:05:41 UTC (rev 11890)
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<!DOCTYPE servers SYSTEM "servertoserver.dtd">
+<!DOCTYPE servers SYSTEM "remoteservers.dtd">
<servers>
<server>
Copied: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.dtd (from rev 11875, CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servertoserver.dtd)
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.dtd (rev 0)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.dtd 2013-11-05 20:05:41 UTC (rev 11890)
@@ -0,0 +1,33 @@
+<!--
+Copyright (c) 2006-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.
+-->
+
+<!ELEMENT servers (server*) >
+
+ <!ELEMENT server (uri, authentication?, allow-requests-from, allow-requests-to, domains?, hosts?) >
+
+ <!ELEMENT uri (#PCDATA) >
+ <!ELEMENT authentication (user, password) >
+ <!ATTLIST authentication type (basic) "">
+ <!ELEMENT user (#PCDATA) >
+ <!ELEMENT password (#PCDATA) >
+
+ <!ELEMENT allow-requests-from EMPTY >
+ <!ELEMENT allow-requests-to EMPTY >
+ <!ELEMENT domains (domain*) >
+ <!ELEMENT domain (#PCDATA) >
+ <!ELEMENT hosts (host*) >
+ <!ELEMENT host (#PCDATA) >
+
\ No newline at end of file
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.xml 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/remoteservers.xml 2013-11-05 20:05:41 UTC (rev 11890)
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<!DOCTYPE servers SYSTEM "servertoserver.dtd">
+<!DOCTYPE servers SYSTEM "remoteservers.dtd">
<servers>
<!--
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/resources/caldavd-resources.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/resources/caldavd-resources.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/resources/caldavd-resources.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -174,7 +174,6 @@
Augments for the directory service records to add calendar specific attributes.
A variety of augment services are available for use.
- When using a partitioned server, a service that can be accessed from each host will be needed.
-->
<!-- XML File Augment Service -->
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servers.dtd
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servers.dtd 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servers.dtd 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,28 +0,0 @@
-<!--
-Copyright (c) 2011-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.
--->
-
-<!ELEMENT servers (server*) >
-
- <!ELEMENT server (id, uri, allowed-from*, shared-secret?, partitions?) >
- <!ATTLIST server implicit (yes|no) "yes">
-
- <!ELEMENT id (#PCDATA) >
- <!ELEMENT uri (#PCDATA) >
- <!ELEMENT allowed-from (#PCDATA) >
- <!ELEMENT shared-secret (#PCDATA) >
-
- <!ELEMENT partitions (partition*) >
- <!ELEMENT partition (id, uri) >
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servertoserver.dtd
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servertoserver.dtd 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/servertoserver.dtd 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,33 +0,0 @@
-<!--
-Copyright (c) 2006-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.
--->
-
-<!ELEMENT servers (server*) >
-
- <!ELEMENT server (uri, authentication?, allow-requests-from, allow-requests-to, domains?, hosts?) >
-
- <!ELEMENT uri (#PCDATA) >
- <!ELEMENT authentication (user, password) >
- <!ATTLIST authentication type (basic) "">
- <!ELEMENT user (#PCDATA) >
- <!ELEMENT password (#PCDATA) >
-
- <!ELEMENT allow-requests-from EMPTY >
- <!ELEMENT allow-requests-to EMPTY >
- <!ELEMENT domains (domain*) >
- <!ELEMENT domain (#PCDATA) >
- <!ELEMENT hosts (host*) >
- <!ELEMENT host (#PCDATA) >
-
\ No newline at end of file
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/sudoers.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/sudoers.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/conf/sudoers.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-<key>users</key>
-<array>
-<!-- Sudo user definitions -->
-<!-- With the exception of username and password none of the following
- elements are used in the current implementation. -->
-<!--
- <dict>
- <key>authorize-as</key>
- <dict>
- <key>allow</key>
- <true/>
- <key>principals</key>
- <array>
- <string>all</string>
- <string>/principals/user/wsanchez</string>
- </array>
- </dict>
- <key>authorize-from</key>
- <array>
- <string>127.0.0.1</string>
- </array>
-
- <key>username</key>
- <string></string>
-
- <key>password</key>
- <string></string>
- </dict>
--->
- <dict>
- <key>username</key>
- <string>superuser</string>
- <key>password</key>
- <string>superuser</string>
- </dict>
-</array>
-</dict>
-</plist>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/contrib/tools/request_monitor.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/contrib/tools/request_monitor.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/contrib/tools/request_monitor.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -303,8 +303,6 @@
print("--procs N specifies how many python processes are expected in the log file (default: 80)")
print("--top N how many long requests to print (default: 10)")
print("--users N how many top users to print (default: 5)")
- print("--router analyze a partition server router node")
- print("--worker analyze a partition server worker node")
print("")
print("Version: 5")
@@ -313,19 +311,13 @@
numTop = 10
numUsers = 5
lineRange = None
-router = False
-worker = False
-options, args = getopt.getopt(sys.argv[1:], "h", ["debug", "router", "worker", "lines=", "range=", "procs=", "top=", "users="])
+options, args = getopt.getopt(sys.argv[1:], "h", ["debug", "lines=", "range=", "procs=", "top=", "users="])
for option, value in options:
if option == "-h":
usage()
sys.exit(0)
elif option == "--debug":
debug = True
- elif option == "--router":
- router = True
- elif option == "--worker":
- worker = True
elif option == "--lines":
numLines = int(value)
elif option == "--range":
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/setup.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/setup.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/setup.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -145,7 +145,6 @@
"bin/calendarserver_export",
#"bin/calendarserver_icalendar_validate",
#"bin/calendarserver_load_augmentdb",
- #"bin/calendarserver_make_partition",
#"bin/calendarserver_manage_postgres",
"bin/calendarserver_manage_principals",
"bin/calendarserver_manage_push",
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/config.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -97,6 +97,8 @@
self._defaults = ConfigDict()
else:
self._defaults = ConfigDict(copy.deepcopy(defaults))
+ self.includedFiles = []
+ self.missingFiles = []
def getDefaults(self):
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/augment.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/augment.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -25,11 +25,11 @@
from twext.python.log import Logger
from twistedcaldav.config import fullServerPath, config
-from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
+from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin, \
ADBAPIPostgreSQLMixin
from twistedcaldav.directory import xmlaugmentsparser
from twistedcaldav.directory.xmlaugmentsparser import XMLAugmentsParser
-from twistedcaldav.xmlutil import newElementTreeWithRoot, addSubElement,\
+from twistedcaldav.xmlutil import newElementTreeWithRoot, addSubElement, \
writeXML, readXML
from twistedcaldav.directory.util import normalizeUUID
@@ -56,7 +56,6 @@
uid,
enabled=False,
serverID="",
- partitionID="",
enabledForCalendaring=False,
autoSchedule=False,
autoScheduleMode="default",
@@ -67,7 +66,6 @@
self.uid = uid
self.enabled = enabled
self.serverID = serverID
- self.partitionID = partitionID
self.enabledForCalendaring = enabledForCalendaring
self.enabledForAddressBooks = enabledForAddressBooks
self.enabledForLogin = enabledForLogin
@@ -87,9 +85,9 @@
"""
Abstract base class for an augment record database.
"""
-
+
def __init__(self):
-
+
self.cachedRecords = {}
@@ -126,10 +124,10 @@
@param uid: directory UID to lookup
@type uid: C{str}
-
+
@return: L{Deferred}
"""
-
+
recordType = recordTypesMap[recordType]
result = (yield self._lookupAugmentRecord(uid))
@@ -166,6 +164,7 @@
result.clonedFromDefault = True
returnValue(result)
+
@inlineCallbacks
def getAllUIDs(self):
"""
@@ -173,21 +172,23 @@
@return: L{Deferred}
"""
-
+
raise NotImplementedError("Child class must define this.")
+
def _lookupAugmentRecord(self, uid):
"""
Get an AugmentRecord for the specified UID.
@param uid: directory UID to lookup
@type uid: C{str}
-
+
@return: L{Deferred}
"""
-
+
raise NotImplementedError("Child class must define this.")
+
@inlineCallbacks
def _cachedAugmentRecord(self, uid):
"""
@@ -195,59 +196,64 @@
@param uid: directory UID to lookup
@type uid: C{str}
-
+
@return: L{Deferred}
"""
-
+
if not uid in self.cachedRecords:
result = (yield self._lookupAugmentRecord(uid))
self.cachedRecords[uid] = result
returnValue(self.cachedRecords[uid])
+
def addAugmentRecords(self, records):
"""
Add an AugmentRecord to the DB.
@param record: augment records to add
@type record: C{list} of L{AugmentRecord}
-
+
@return: L{Deferred}
"""
raise NotImplementedError("Child class must define this.")
+
def removeAugmentRecords(self, uids):
"""
Remove AugmentRecords with the specified UIDs.
@param uid: directory UIDs to remove
@type uid: C{list} of C{str}
-
+
@return: L{Deferred}
"""
raise NotImplementedError("Child class must define this.")
+
def refresh(self):
"""
Refresh any cached data.
-
+
@return: L{Deferred}
"""
self.cachedRecords.clear()
return succeed(None)
-
+
+
def clean(self):
"""
Remove all records.
-
+
@return: L{Deferred}
"""
raise NotImplementedError("Child class must define this.")
+
class AugmentXMLDB(AugmentDB):
"""
XMLFile based augment database implementation.
@@ -257,7 +263,7 @@
super(AugmentXMLDB, self).__init__()
self.xmlFiles = [fullServerPath(config.DataRoot, path) for path in xmlFiles]
- self.xmlFileStats = { }
+ self.xmlFileStats = {}
for path in self.xmlFiles:
self.xmlFileStats[path] = (0, 0) # mtime, size
@@ -290,16 +296,17 @@
@param uid: directory UID to lookup
@type uid: C{str}
-
+
@return: L{Deferred}
"""
-
+
# May need to re-cache
if time.time() - self.lastCached > self.statSeconds:
self.refresh()
-
+
return succeed(self.db.get(uid))
+
def addAugmentRecords(self, records):
"""
Add an AugmentRecord to the DB.
@@ -308,13 +315,13 @@
@type records: C{list} of L{AugmentRecord}
@param update: C{True} if changing an existing record
@type update: C{bool}
-
+
@return: L{Deferred}
"""
# Look at each record and determine whether it is new or a modify
new_records = list()
- existing_records = list()
+ existing_records = list()
for record in records:
(existing_records if record.uid in self.db else new_records).append(record)
@@ -332,6 +339,7 @@
return succeed(None)
+
def _doAddToFile(self, xmlfile, records):
if not os.path.exists(xmlfile):
@@ -343,7 +351,6 @@
for record in self.db.itervalues():
self._addRecordToXMLDB(record, augments_node)
-
writeXML(xmlfile, augments_node)
# Set permissions
@@ -362,33 +369,33 @@
if uid != -1 and gid != -1:
os.chown(xmlfile, uid, gid)
-
_ignore_etree, augments_node = readXML(xmlfile)
# Create new record
for record in records:
self._addRecordToXMLDB(record, augments_node)
-
+
# Modify xmlfile
writeXML(xmlfile, augments_node)
-
+
+
def _doModifyInFile(self, xmlfile, records):
-
+
if not os.path.exists(xmlfile):
return
_ignore_etree, augments_node = readXML(xmlfile)
-
+
# Map uid->record for fast lookup
recordMap = dict([(record.uid, record) for record in records])
# Make sure UID is present
changed = False
for record_node in augments_node:
-
+
if record_node.tag != xmlaugmentsparser.ELEMENT_RECORD:
continue
-
+
uid = record_node.find(xmlaugmentsparser.ELEMENT_UID).text
if uid in recordMap:
# Modify record
@@ -400,13 +407,14 @@
if changed:
writeXML(xmlfile, augments_node)
+
def removeAugmentRecords(self, uids):
"""
Remove AugmentRecords with the specified UIDs.
@param uids: list of uids to remove
@type uids: C{list} of C{str}
-
+
@return: L{Deferred}
"""
@@ -423,10 +431,11 @@
return succeed(None)
+
def _doRemoveFromFile(self, xmlfile, uids):
-
+
_ignore_etree, augments_node = readXML(xmlfile)
-
+
# Remove all UIDs present
changed = False
for child in augments_node:
@@ -440,20 +449,19 @@
# Modify xmlfile
if changed:
writeXML(xmlfile, augments_node)
-
-
+
+
def _addRecordToXMLDB(self, record, parentNode):
record_node = addSubElement(parentNode, xmlaugmentsparser.ELEMENT_RECORD)
self._updateRecordInXMLDB(record, record_node)
+
def _updateRecordInXMLDB(self, record, recordNode):
del recordNode[:]
addSubElement(recordNode, xmlaugmentsparser.ELEMENT_UID, record.uid)
addSubElement(recordNode, xmlaugmentsparser.ELEMENT_ENABLE, "true" if record.enabled else "false")
if record.serverID:
addSubElement(recordNode, xmlaugmentsparser.ELEMENT_SERVERID, record.serverID)
- if record.partitionID:
- addSubElement(recordNode, xmlaugmentsparser.ELEMENT_PARTITIONID, record.partitionID)
addSubElement(recordNode, xmlaugmentsparser.ELEMENT_ENABLECALENDAR, "true" if record.enabledForCalendaring else "false")
addSubElement(recordNode, xmlaugmentsparser.ELEMENT_ENABLEADDRESSBOOK, "true" if record.enabledForAddressBooks else "false")
addSubElement(recordNode, xmlaugmentsparser.ELEMENT_ENABLELOGIN, "true" if record.enabledForLogin else "false")
@@ -463,6 +471,7 @@
if record.autoAcceptGroup:
addSubElement(recordNode, xmlaugmentsparser.ELEMENT_AUTOACCEPTGROUP, record.autoAcceptGroup)
+
def refresh(self):
"""
Refresh any cached data.
@@ -479,6 +488,7 @@
return succeed(None)
+
def clean(self):
"""
Remove all records.
@@ -487,6 +497,7 @@
self.removeAugmentRecords(self.db.keys())
return succeed(None)
+
def _shouldReparse(self, xmlFiles):
"""
Check to see whether any of the given files have been modified since
@@ -501,6 +512,7 @@
return True
return False
+
def _parseXML(self):
"""
Parse self.xmlFiles into AugmentRecords.
@@ -536,19 +548,22 @@
return results
+
+
class AugmentADAPI(AugmentDB, AbstractADBAPIDatabase):
"""
DBAPI based augment database implementation.
"""
- schema_version = "2"
- schema_type = "AugmentDB"
-
+ schema_version = "3"
+ schema_type = "AugmentDB"
+
def __init__(self, dbID, dbapiName, dbapiArgs, **kwargs):
-
+
AugmentDB.__init__(self)
AbstractADBAPIDatabase.__init__(self, dbID, dbapiName, dbapiArgs, True, **kwargs)
-
+
+
@inlineCallbacks
def getAllUIDs(self):
"""
@@ -556,11 +571,12 @@
@return: L{Deferred}
"""
-
+
# Query for the record information
results = (yield self.queryList("select UID from AUGMENTS", ()))
returnValue(results)
+
@inlineCallbacks
def _lookupAugmentRecord(self, uid):
"""
@@ -571,34 +587,34 @@
@return: L{Deferred}
"""
-
+
# Query for the record information
- results = (yield self.query("select UID, ENABLED, SERVERID, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED from AUGMENTS where UID = :1", (uid,)))
+ results = (yield self.query("select UID, ENABLED, SERVERID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED from AUGMENTS where UID = :1", (uid,)))
if not results:
returnValue(None)
else:
- uid, enabled, serverid, partitionid, enabledForCalendaring, enabledForAddressBooks, autoSchedule, autoScheduleMode, autoAcceptGroup, enabledForLogin = results[0]
-
+ uid, enabled, serverid, enabledForCalendaring, enabledForAddressBooks, autoSchedule, autoScheduleMode, autoAcceptGroup, enabledForLogin = results[0]
+
record = AugmentRecord(
- uid = uid,
- enabled = enabled == "T",
- serverID = serverid,
- partitionID = partitionid,
- enabledForCalendaring = enabledForCalendaring == "T",
- enabledForAddressBooks = enabledForAddressBooks == "T",
- enabledForLogin = enabledForLogin == "T",
- autoSchedule = autoSchedule == "T",
- autoScheduleMode = autoScheduleMode,
- autoAcceptGroup = autoAcceptGroup,
+ uid=uid,
+ enabled=enabled == "T",
+ serverID=serverid,
+ enabledForCalendaring=enabledForCalendaring == "T",
+ enabledForAddressBooks=enabledForAddressBooks == "T",
+ enabledForLogin=enabledForLogin == "T",
+ autoSchedule=autoSchedule == "T",
+ autoScheduleMode=autoScheduleMode,
+ autoAcceptGroup=autoAcceptGroup,
)
-
+
returnValue(record)
+
@inlineCallbacks
def addAugmentRecords(self, records):
for record in records:
-
+
results = (yield self.query("select UID from AUGMENTS where UID = :1", (record.uid,)))
update = len(results) > 0
@@ -607,6 +623,7 @@
else:
yield self._addRecord(record)
+
@inlineCallbacks
def removeAugmentRecords(self, uids):
"""
@@ -614,32 +631,36 @@
@param uids: list of uids to remove
@type uids: C{list} of C{str}
-
+
@return: L{Deferred}
"""
for uid in uids:
yield self.execute("delete from AUGMENTS where UID = :1", (uid,))
+
def clean(self):
"""
Remove all records.
"""
return self.execute("delete from AUGMENTS", ())
-
+
+
def _db_version(self):
"""
@return: the schema version assigned to this index.
"""
return AugmentADAPI.schema_version
-
+
+
def _db_type(self):
"""
@return: the collection type assigned to this index.
"""
return AugmentADAPI.schema_type
-
+
+
@inlineCallbacks
def _db_init_data_tables(self):
"""
@@ -652,45 +673,47 @@
yield self._create_table(
"AUGMENTS",
(
- ("UID", "text unique"),
- ("ENABLED", "text(1)"),
- ("SERVERID", "text"),
- ("PARTITIONID", "text"),
- ("CALENDARING", "text(1)"),
- ("ADDRESSBOOKS", "text(1)"),
- ("AUTOSCHEDULE", "text(1)"),
+ ("UID", "text unique"),
+ ("ENABLED", "text(1)"),
+ ("SERVERID", "text"),
+ ("CALENDARING", "text(1)"),
+ ("ADDRESSBOOKS", "text(1)"),
+ ("AUTOSCHEDULE", "text(1)"),
("AUTOSCHEDULEMODE", "text"),
- ("AUTOACCEPTGROUP", "text"),
- ("LOGINENABLED", "text(1)"),
+ ("AUTOACCEPTGROUP", "text"),
+ ("LOGINENABLED", "text(1)"),
),
ifnotexists=True,
)
+
@inlineCallbacks
def _db_empty_data_tables(self):
yield self._db_execute("delete from AUGMENTS")
+
+
class AugmentSqliteDB(ADBAPISqliteMixin, AugmentADAPI):
"""
Sqlite based augment database implementation.
"""
def __init__(self, dbpath):
-
+
ADBAPISqliteMixin.__init__(self)
AugmentADAPI.__init__(self, "Augments", "sqlite3", (fullServerPath(config.DataRoot, dbpath),))
+
@inlineCallbacks
def _addRecord(self, record):
yield self.execute(
"""insert or replace into AUGMENTS
- (UID, ENABLED, SERVERID, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED)
- values (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10)""",
+ (UID, ENABLED, SERVERID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED)
+ values (:1, :2, :3, :4, :5, :6, :7, :8, :9)""",
(
record.uid,
"T" if record.enabled else "F",
record.serverID,
- record.partitionID,
"T" if record.enabledForCalendaring else "F",
"T" if record.enabledForAddressBooks else "F",
"T" if record.autoSchedule else "F",
@@ -700,30 +723,33 @@
)
)
+
def _modifyRecord(self, record):
return self._addRecord(record)
+
+
class AugmentPostgreSQLDB(ADBAPIPostgreSQLMixin, AugmentADAPI):
"""
PostgreSQL based augment database implementation.
"""
def __init__(self, host, database, user=None, password=None):
-
+
ADBAPIPostgreSQLMixin.__init__(self)
AugmentADAPI.__init__(self, "Augments", "pgdb", (), host=host, database=database, user=user, password=password,)
+
@inlineCallbacks
def _addRecord(self, record):
yield self.execute(
"""insert into AUGMENTS
- (UID, ENABLED, SERVERID, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED)
- values (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10)""",
+ (UID, ENABLED, SERVERID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED)
+ values (:1, :2, :3, :4, :5, :6, :7, :8, :9)""",
(
record.uid,
"T" if record.enabled else "F",
record.serverID,
- record.partitionID,
"T" if record.enabledForCalendaring else "F",
"T" if record.enabledForAddressBooks else "F",
"T" if record.autoSchedule else "F",
@@ -733,17 +759,17 @@
)
)
+
@inlineCallbacks
def _modifyRecord(self, record):
yield self.execute(
"""update AUGMENTS set
- (UID, ENABLED, SERVERID, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED) =
- (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10) where UID = :11""",
+ (UID, ENABLED, SERVERID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE, AUTOSCHEDULEMODE, AUTOACCEPTGROUP, LOGINENABLED) =
+ (:1, :2, :3, :4, :5, :6, :7, :8, :9) where UID = :10""",
(
record.uid,
"T" if record.enabled else "F",
record.serverID,
- record.partitionID,
"T" if record.enabledForCalendaring else "F",
"T" if record.enabledForAddressBooks else "F",
"T" if record.autoSchedule else "F",
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/common.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/common.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/common.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -42,7 +42,7 @@
Common ancestor for addressbook/calendar UID provisioning resources.
Must be mixed in to the hierarchy I{before} the appropriate resource type.
-
+
@ivar homeResourceTypeName: The name of the home resource type ('calendars'
or 'addressbooks').
@@ -78,13 +78,11 @@
assert len(name) > 4, "Directory record has an invalid GUID: %r" % (
name,)
-
- if record.locallyHosted():
+
+ if record.thisServer():
child = yield self.homeResourceCreator(record, transaction)
- elif record.thisServer():
+ else:
child = DirectoryReverseProxyResource(self, record)
- else:
- child = None # Use a redirect?
returnValue(child)
@@ -108,6 +106,7 @@
# Not a listable collection
raise HTTPError(responsecode.FORBIDDEN)
+
##
# ACL
##
@@ -115,12 +114,15 @@
def principalCollections(self):
return self.parent.principalCollections()
+
def principalForRecord(self, record):
return self.parent.principalForRecord(record)
+
+
##
# DAV
##
-
+
def isCollection(self):
return True
@@ -129,9 +131,11 @@
raise NotImplementedError(self.__class__.__name__ +
".getChild no longer exists.")
+
def displayName(self):
return uidsResourceName
+
def url(self):
return joinURL(self.parent.url(), uidsResourceName)
@@ -153,4 +157,3 @@
child = yield self._parent.homeForDirectoryRecord(record, request)
returnValue((child, segments[1:]))
-
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory-principal-resource.html
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory-principal-resource.html 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory-principal-resource.html 2013-11-05 20:05:41 UTC (rev 11890)
@@ -5,8 +5,7 @@
---------------------
Directory GUID: <t:slot name="directoryGUID"/>
Realm: <t:slot name="realm"/>
-<t:transparent t:render="serversEnabled">Hosted-At: <t:slot name="hostedAt"/>
-Partition: <t:slot name="partition"/></t:transparent>
+<t:transparent t:render="serversEnabled">Hosted-At: <t:slot name="hostedAt"/></t:transparent>
Principal Information
---------------------
GUID: <t:slot name="principalGUID"/>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/directory.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -89,8 +89,8 @@
searchContext_location = "location"
searchContext_resource = "resource"
- searchContext_user = "user"
- searchContext_group = "group"
+ searchContext_user = "user"
+ searchContext_group = "group"
searchContext_attendee = "attendee"
aggregateService = None
@@ -628,6 +628,7 @@
self.expireSeconds = expireSeconds
self.lockSeconds = lockSeconds
+
def setGroupsFor(self, guid, memberships):
self.log.debug("set groups-for %s : %s" % (guid, memberships))
return self.set("groups-for:%s" %
@@ -675,7 +676,6 @@
return self.add("group-cacher-lock", "1", expireTime=self.lockSeconds)
-
def extendLock(self):
"""
Update the expiration time of the memcached lock
@@ -694,6 +694,7 @@
return self.delete("group-cacher-lock")
+
class GroupMembershipCacheUpdater(object):
"""
Responsible for updating memcached with group memberships. This will run
@@ -1130,7 +1131,7 @@
implements(IDirectoryRecord, ICalendarStoreDirectoryRecord)
def __repr__(self):
- return "<%s[%s@%s(%s)] %s(%s) %r @ %s/#%s>" % (
+ return "<%s[%s@%s(%s)] %s(%s) %r @ %s>" % (
self.__class__.__name__,
self.recordType,
self.service.guid,
@@ -1139,7 +1140,6 @@
",".join(self.shortNames),
self.fullName,
self.serverURI(),
- self.partitionID,
)
@@ -1175,7 +1175,6 @@
self.uid = uid
self.enabled = False
self.serverID = ""
- self.partitionID = ""
self.shortNames = shortNames
self.authIDs = authIDs
self.fullName = fullName
@@ -1257,7 +1256,6 @@
if augment:
self.enabled = augment.enabled
self.serverID = augment.serverID
- self.partitionID = augment.partitionID
self.enabledForCalendaring = augment.enabledForCalendaring
self.enabledForAddressBooks = augment.enabledForAddressBooks
self.autoSchedule = augment.autoSchedule
@@ -1278,7 +1276,6 @@
# Groups are by default always enabled
self.enabled = (self.recordType == self.service.recordType_groups)
self.serverID = ""
- self.partitionID = ""
self.enabledForCalendaring = False
self.enabledForAddressBooks = False
self.enabledForLogin = False
@@ -1496,46 +1493,9 @@
return None
- def partitionURI(self):
- """
- URL of the server hosting this record. Return None if hosted on this server.
- """
- if config.Servers.Enabled and self.serverID:
- s = Servers.getServerById(self.serverID)
- if s:
- return s.getPartitionURIForId(self.partitionID)
- return None
-
-
- def locallyHosted(self):
- """
- Hosted on this server/partition instance.
- """
-
- if config.Servers.Enabled and self.serverID:
- s = Servers.getServerById(self.serverID)
- if s:
- return s.thisServer and (not s.isPartitioned() or not self.partitionID or self.partitionID == config.ServerPartitionID)
- return True
-
-
- def effectivePartitionID(self):
- """
- Record partition ID taking into account whether the server is partitioned.
- """
- if config.Servers.Enabled and self.serverID:
- s = Servers.getServerById(self.serverID)
- if s and s.isPartitioned():
- return self.partitionID
- return ""
-
-
def thisServer(self):
- if config.Servers.Enabled and self.serverID:
- s = Servers.getServerById(self.serverID)
- if s:
- return s.thisServer
- return True
+ s = self.server()
+ return s.thisServer if s is not None else True
def autoAcceptMembers(self):
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/idirectory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/idirectory.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/idirectory.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -32,20 +32,20 @@
realmName = Attribute("The name of the authentication realm this service represents.")
guid = Attribute("A GUID for this service.")
- def recordTypes():
+ def recordTypes(): #@NoSelf
"""
@return: a sequence of strings denoting the record types that
are kept in the directory. For example: C{["users",
"groups", "resources"]}.
"""
- def listRecords(recordType):
+ def listRecords(recordType): #@NoSelf
"""
@param type: the type of records to retrieve.
@return: an iterable of records of the given type.
"""
- def recordWithShortName(recordType, shortName):
+ def recordWithShortName(recordType, shortName): #@NoSelf
"""
@param recordType: the type of the record to look up.
@param shortName: the short name of the record to look up.
@@ -53,21 +53,21 @@
C{None} if no such record exists.
"""
- def recordWithUID(uid):
+ def recordWithUID(uid): #@NoSelf
"""
@param uid: the UID of the record to look up.
@return: an L{IDirectoryRecord} with the given UID, or C{None}
if no such record exists.
"""
- def recordWithGUID(guid):
+ def recordWithGUID(guid): #@NoSelf
"""
@param guid: the GUID of the record to look up.
@return: an L{IDirectoryRecord} with the given GUID, or
C{None} if no such record exists.
"""
- def recordWithCalendarUserAddress(address):
+ def recordWithCalendarUserAddress(address): #@NoSelf
"""
@param address: the calendar user address of the record to look up.
@type address: C{str}
@@ -81,7 +81,7 @@
directory service may not be aware of these addresses.
"""
- def recordWithCachedGroupsAlias(recordType, alias):
+ def recordWithCachedGroupsAlias(recordType, alias): #@NoSelf
"""
@param recordType: the type of the record to look up.
@param alias: the cached-groups alias of the record to look up.
@@ -91,14 +91,13 @@
alias, or C{None} if no such record is found.
"""
-
- def recordsMatchingFields(fields):
+ def recordsMatchingFields(fields): #@NoSelf
"""
@return: a deferred sequence of L{IDirectoryRecord}s which
match the given fields.
"""
- def recordsMatchingTokens(tokens, context=None):
+ def recordsMatchingTokens(tokens, context=None): #@NoSelf
"""
@param tokens: The tokens to search on
@type tokens: C{list} of C{str} (utf-8 bytes)
@@ -119,31 +118,31 @@
"attendee", only users, groups, and resources are considered.
"""
-
- def setRealm(realmName):
+ def setRealm(realmName): #@NoSelf
"""
Set a new realm name for this (and nested services if any)
@param realmName: the realm name this service should use.
"""
+
+
class IDirectoryRecord(Interface):
"""
Directory Record
"""
- service = Attribute("The L{IDirectoryService} this record exists in.")
- recordType = Attribute("The type of this record.")
- guid = Attribute("The GUID of this record.")
- uid = Attribute("The UID of this record.")
- enabled = Attribute("Determines whether this record should allow a principal to be created.")
- serverID = Attribute("Identifies the server that actually hosts data for the record.")
- partitionID = Attribute("Identifies the partition node that actually hosts data for the record.")
- shortNames = Attribute("The names for this record.")
- authIDs = Attribute("Alternative security identities for this record.")
- fullName = Attribute("The full name of this record.")
- firstName = Attribute("The first name of this record.")
- lastName = Attribute("The last name of this record.")
- emailAddresses = Attribute("The email addresses of this record.")
+ service = Attribute("The L{IDirectoryService} this record exists in.")
+ recordType = Attribute("The type of this record.")
+ guid = Attribute("The GUID of this record.")
+ uid = Attribute("The UID of this record.")
+ enabled = Attribute("Determines whether this record should allow a principal to be created.")
+ serverID = Attribute("Identifies the server that actually hosts data for the record.")
+ shortNames = Attribute("The names for this record.")
+ authIDs = Attribute("Alternative security identities for this record.")
+ fullName = Attribute("The full name of this record.")
+ firstName = Attribute("The first name of this record.")
+ lastName = Attribute("The last name of this record.")
+ emailAddresses = Attribute("The email addresses of this record.")
enabledForCalendaring = Attribute("Determines whether this record creates a principal with a calendar home.")
enabledForAddressBooks = Attribute("Determines whether this record creates a principal with an address book home.")
calendarUserAddresses = Attribute(
@@ -159,19 +158,19 @@
"""
)
- def members():
+ def members(): #@NoSelf
"""
@return: an iterable of L{IDirectoryRecord}s for the members of this
(group) record.
"""
- def groups():
+ def groups(): #@NoSelf
"""
@return: an iterable of L{IDirectoryRecord}s for the groups this
record is a member of.
"""
- def verifyCredentials(credentials):
+ def verifyCredentials(credentials): #@NoSelf
"""
Verify that the given credentials can authenticate the principal
represented by this record.
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/ldapdirectory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/ldapdirectory.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/ldapdirectory.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -75,12 +75,13 @@
return "<%s %r: %r>" % (self.__class__.__name__, self.realmName,
self.uri)
+
def __init__(self, params):
"""
@param params: a dictionary containing the following keys:
cacheTimeout, realmName, uri, tls, tlsCACertFile, tlsCACertDir,
tlsRequireCert, credentials, rdnSchema, groupSchema, resourceSchema
- partitionSchema
+ poddingSchema
"""
defaults = {
@@ -188,9 +189,8 @@
"readOnlyProxyAttr": None, # list of GUIDs
"autoAcceptGroupAttr": None, # single group GUID
},
- "partitionSchema": {
+ "poddingSchema": {
"serverIdAttr": None, # maps to augments server-id
- "partitionIdAttr": None, # maps to augments partition-id
},
}
ignored = None
@@ -222,7 +222,7 @@
self.rdnSchema = params["rdnSchema"]
self.groupSchema = params["groupSchema"]
self.resourceSchema = params["resourceSchema"]
- self.partitionSchema = params["partitionSchema"]
+ self.poddingSchema = params["poddingSchema"]
self.base = ldap.dn.str2dn(self.rdnSchema["base"])
@@ -272,10 +272,8 @@
attrSet.add(self.resourceSchema["proxyAttr"])
if self.resourceSchema["readOnlyProxyAttr"]:
attrSet.add(self.resourceSchema["readOnlyProxyAttr"])
- if self.partitionSchema["serverIdAttr"]:
- attrSet.add(self.partitionSchema["serverIdAttr"])
- if self.partitionSchema["partitionIdAttr"]:
- attrSet.add(self.partitionSchema["partitionIdAttr"])
+ if self.poddingSchema["serverIdAttr"]:
+ attrSet.add(self.poddingSchema["serverIdAttr"])
self.attrlist = list(attrSet)
self.typeDNs = {}
@@ -284,10 +282,8 @@
self.rdnSchema[recordType]["rdn"].lower()
) + self.base
-
self.ldap = None
-
# Separate LDAP connection used solely for authenticating clients
self.authLDAP = None
@@ -314,7 +310,7 @@
# Query the LDAP server
self.log.debug("Querying ldap for records matching base {base} and "
- "filter {filter} for attributes {attrs}.",
+ "filter {filter} for attributes {attrs}.",
base=ldap.dn.dn2str(base), filter=filterstr, attrs=self.attrlist)
# This takes a while, so if you don't want to have a "long request"
@@ -353,6 +349,7 @@
return records
+
@inlineCallbacks
def recordWithCachedGroupsAlias(self, recordType, alias):
"""
@@ -373,6 +370,7 @@
else:
returnValue(None)
+
def getExternalProxyAssignments(self):
"""
Retrieve proxy assignments for locations and resources from the
@@ -425,6 +423,7 @@
return assignments
+
def getLDAPConnection(self):
if self.ldap is None:
self.log.info("Connecting to LDAP {uri}", uri=repr(self.uri))
@@ -443,6 +442,7 @@
raise DirectoryConfigurationError()
return self.ldap
+
def createLDAPConnection(self):
"""
Create and configure LDAP connection
@@ -478,7 +478,7 @@
"""
TRIES = 3
- for i in xrange(TRIES):
+ for _ignore_i in xrange(TRIES):
self.log.debug("Authenticating %s" % (dn,))
if self.authLDAP is None:
@@ -555,11 +555,11 @@
self.log.warn("LDAP timeout exceeded: %d seconds" % (timeoutSeconds,))
except ldap.SERVER_DOWN:
self.ldap = None
- self.log.error("LDAP server unavailable (tried %d times)" % (i+1,))
+ self.log.error("LDAP server unavailable (tried %d times)" % (i + 1,))
continue
# change format, ignoring resultsType
- result = [resultItem for resultType, resultItem in s.allResults]
+ result = [resultItem for _ignore_resultType, resultItem in s.allResults]
totalTime = time.time() - startTime
if totalTime > self.warningThresholdSeconds:
@@ -769,7 +769,6 @@
"""
guid = None
- shortNames = ()
authIDs = set()
fullName = None
firstName = ""
@@ -891,30 +890,27 @@
autoAcceptGroup = self._getUniqueLdapAttribute(attrs,
self.resourceSchema["autoAcceptGroupAttr"])
- serverID = partitionID = None
- if self.partitionSchema["serverIdAttr"]:
+ serverID = None
+ if self.poddingSchema["serverIdAttr"]:
serverID = self._getUniqueLdapAttribute(attrs,
- self.partitionSchema["serverIdAttr"])
- if self.partitionSchema["partitionIdAttr"]:
- partitionID = self._getUniqueLdapAttribute(attrs,
- self.partitionSchema["partitionIdAttr"])
+ self.poddingSchema["serverIdAttr"])
record = LdapDirectoryRecord(
- service = self,
- recordType = recordType,
- guid = guid,
- shortNames = shortNames,
- authIDs = authIDs,
- fullName = fullName,
- firstName = firstName,
- lastName = lastName,
- emailAddresses = emailAddresses,
- uid = uid,
- dn = dn,
- memberGUIDs = memberGUIDs,
- extProxies = proxyGUIDs,
- extReadOnlyProxies = readOnlyProxyGUIDs,
- attrs = attrs,
+ service=self,
+ recordType=recordType,
+ guid=guid,
+ shortNames=shortNames,
+ authIDs=authIDs,
+ fullName=fullName,
+ firstName=firstName,
+ lastName=lastName,
+ emailAddresses=emailAddresses,
+ uid=uid,
+ dn=dn,
+ memberGUIDs=memberGUIDs,
+ extProxies=proxyGUIDs,
+ extReadOnlyProxies=readOnlyProxyGUIDs,
+ attrs=attrs,
)
if self.augmentService is not None:
@@ -924,7 +920,7 @@
# immediately.
d = self.augmentService.getAugmentRecord(record.guid,
recordType)
- d.addCallback(lambda x:record.addAugmentInformation(x))
+ d.addCallback(lambda x: record.addAugmentInformation(x))
else:
# Generate augment record based on information retrieved from LDAP
@@ -932,7 +928,6 @@
guid,
enabled=True,
serverID=serverID,
- partitionID=partitionID,
enabledForCalendaring=enabledForCalendaring,
autoSchedule=autoSchedule,
autoAcceptGroup=autoAcceptGroup,
@@ -965,7 +960,7 @@
matching the indexType and indexKey parameters.
recordTypes is a list of record types to limit the search to.
- indexType specifies one of the CachingDirectoryService contstants
+ indexType specifies one of the CachingDirectoryService constants
identifying which attribute to search on.
indexKey is the value to search for.
@@ -994,7 +989,8 @@
# Query on guid only works if guid attribute has been defined.
# Support for query on guid even if is auto-generated should
# be added.
- if not guidAttr: return
+ if not guidAttr:
+ return
filterstr = "(&%s(%s=%s))" % (filterstr, guidAttr, indexKey)
elif indexType == self.INDEX_TYPE_SHORTNAME:
@@ -1157,7 +1153,6 @@
self.log.debug("LDAP search returned %d results, %d usable" % (len(results), typeCounts[recordType]))
-
typeCountsStr = ", ".join(["%s:%d" % (rt, ct) for (rt, ct) in typeCounts.iteritems()])
totalTime = time.time() - startTime
self.log.info("Calendar user search for %s matched %d records (%s) in %.2f seconds" % (tokens, len(records), typeCountsStr, totalTime))
@@ -1172,7 +1167,7 @@
"""
records = []
- self.log.debug("Peforming principal property search for %s" % (fields,))
+ self.log.debug("Performing principal property search for %s" % (fields,))
if recordType is None:
# Make a copy since we're modifying it
@@ -1324,6 +1319,7 @@
returnValue(recordsByAlias.values())
+
def recordTypeForDN(self, dnStr):
"""
Examine a DN to determine which recordType it belongs to
@@ -1339,6 +1335,7 @@
return None
+
def dnContainedIn(child, parent):
"""
Return True if child dn is contained within parent dn, otherwise False.
@@ -1346,6 +1343,7 @@
return child[-len(parent):] == parent
+
def normalizeDNstr(dnStr):
"""
Convert to lowercase and remove extra whitespace
@@ -1356,6 +1354,7 @@
return ' '.join(ldap.dn.dn2str(ldap.dn.str2dn(dnStr.lower())).split())
+
def _convertValue(value, matchType):
if matchType == "starts-with":
value = "%s*" % (ldapEsc(value),)
@@ -1366,6 +1365,8 @@
value = ldapEsc(value)
return value
+
+
def buildFilter(recordType, mapping, fields, operand="or", optimizeMultiName=False):
"""
Create an LDAP filter string from a list of tuples representing directory
@@ -1403,8 +1404,8 @@
# try the various firstName/lastName permutations:
if recordType == "users":
converted = []
- for firstName, firstCaseless, firstMatchType in combined["firstName"]:
- for lastName, lastCaseless, lastMatchType in combined["lastName"]:
+ for firstName, _ignore_firstCaseless, firstMatchType in combined["firstName"]:
+ for lastName, _ignore_lastCaseless, lastMatchType in combined["lastName"]:
if firstName != lastName:
firstValue = _convertValue(firstName, firstMatchType)
lastValue = _convertValue(lastName, lastMatchType)
@@ -1427,7 +1428,7 @@
# name, guid)
additional = []
for key in ("recordName", "guid"):
- if mapping.has_key(key):
+ if key in mapping:
additional.append("(%s=*)" % (mapping.get(key),))
if additional:
filterstr = "(&%s%s)" % ("".join(additional), filterstr)
@@ -1435,6 +1436,7 @@
return filterstr
+
def buildFilterFromTokens(recordType, mapping, tokens, extra=None):
"""
Create an LDAP filter string from a list of query tokens. Each token is
@@ -1497,6 +1499,7 @@
return filterStr
+
class LdapDirectoryRecord(CachingDirectoryRecord):
"""
LDAP implementation of L{IDirectoryRecord}.
@@ -1509,18 +1512,18 @@
attrs
):
super(LdapDirectoryRecord, self).__init__(
- service = service,
- recordType = recordType,
- guid = guid,
- shortNames = shortNames,
- authIDs = authIDs,
- fullName = fullName,
- firstName = firstName,
- lastName = lastName,
- emailAddresses = emailAddresses,
- extProxies = extProxies,
- extReadOnlyProxies = extReadOnlyProxies,
- uid = uid,
+ service=service,
+ recordType=recordType,
+ guid=guid,
+ shortNames=shortNames,
+ authIDs=authIDs,
+ fullName=fullName,
+ firstName=firstName,
+ lastName=lastName,
+ emailAddresses=emailAddresses,
+ extProxies=extProxies,
+ extReadOnlyProxies=extReadOnlyProxies,
+ uid=uid,
)
# Save attributes of dn and attrs in case you might need them later
@@ -1548,6 +1551,7 @@
self._members_storage = self._members()
return self._members_storage
+
def _members(self):
""" Fault in records for the members of this group """
@@ -1578,7 +1582,7 @@
dn, attrs = result.pop()
dn = normalizeDNstr(dn)
- self.log.debug("Retrieved: %s %s" % (dn,attrs))
+ self.log.debug("Retrieved: %s %s" % (dn, attrs))
recordType = self.service.recordTypeForDN(dn)
if recordType is None:
self.log.error("Unable to map %s to a record type" % (dn,))
@@ -1595,6 +1599,7 @@
return results
+
def groups(self):
""" Return the records representing groups this record is a member of """
try:
@@ -1603,6 +1608,7 @@
self._groups_storage = self._groups()
return self._groups_storage
+
def _groups(self):
""" Fault in the groups of which this record is a member """
@@ -1618,7 +1624,7 @@
if len(membersAttrs) == 1:
filterstr = "(%s=%s)" % (membersAttrs[0], self._memberId)
else:
- filterstr = "(|%s)" % ( "".join(
+ filterstr = "(|%s)" % ("".join(
["(%s=%s)" % (a, self._memberId) for a in membersAttrs]
),
)
@@ -1641,6 +1647,7 @@
return groups
+
def cachedGroupsAlias(self):
"""
See directory.py for full description
@@ -1650,6 +1657,7 @@
"""
return self._memberId
+
def memberGUIDs(self):
return set(self._memberGUIDs)
@@ -1717,10 +1725,13 @@
return super(LdapDirectoryRecord, self).verifyCredentials(credentials)
+
class MissingRecordNameException(Exception):
""" Raised when LDAP record is missing recordName """
pass
+
+
class MissingGuidException(Exception):
""" Raised when LDAP record is missing guidAttr and it's required """
pass
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/principal.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/principal.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -601,7 +601,6 @@
record = self.resource.record
return tag.fillSlots(
hostedAt=str(record.serverURI()),
- partition=str(record.effectivePartitionID()),
)
@@ -1066,14 +1065,6 @@
return self.record.server()
- def partitionURI(self):
- return self.record.partitionURI()
-
-
- def locallyHosted(self):
- return self.record.locallyHosted()
-
-
def thisServer(self):
return self.record.thisServer()
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/resource.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/resource.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/resource.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -25,14 +25,13 @@
__all__ = ["DirectoryReverseProxyResource"]
class DirectoryReverseProxyResource(ReverseProxyResource):
-
+
def __init__(self, parent, record):
self.parent = parent
self.record = record
-
- super(DirectoryReverseProxyResource, self).__init__(self.record.partitionID)
-
- def url(self):
- return joinURL(self.parent.url(), self.record.uid)
+ super(DirectoryReverseProxyResource, self).__init__(self.record.serverID)
+
+ def url(self):
+ return joinURL(self.parent.url(), self.record.uid)
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test-default.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test-default.xml 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test-default.xml 2013-11-05 20:05:41 UTC (rev 11890)
@@ -24,40 +24,34 @@
<enable>true</enable>
<enable-calendar>true</enable-calendar>
<enable-addressbook>true</enable-addressbook>
- <partition-id>00001</partition-id>
</record>
<record>
<uid>Location-Default</uid>
<enable>true</enable>
<enable-calendar>true</enable-calendar>
- <partition-id>00004</partition-id>
<auto-schedule>true</auto-schedule>
</record>
<record>
<uid>Location-AA*</uid>
<enable>true</enable>
<enable-calendar>true</enable-calendar>
- <partition-id>00005</partition-id>
<auto-schedule>true</auto-schedule>
</record>
<record>
<uid>Resource-Default</uid>
<enable>true</enable>
<enable-calendar>true</enable-calendar>
- <partition-id>00006</partition-id>
<auto-schedule>true</auto-schedule>
</record>
<record>
<uid>Resource-AA*</uid>
<enable>true</enable>
<enable-calendar>true</enable-calendar>
- <partition-id>00007</partition-id>
<auto-schedule>true</auto-schedule>
</record>
<record>
<uid>AA*</uid>
<enable>true</enable>
- <partition-id>00001</partition-id>
</record>
<record>
<uid>AB*</uid>
@@ -66,14 +60,12 @@
<record>
<uid>B*</uid>
<enable>true</enable>
- <partition-id>00002</partition-id>
<enable-calendar>true</enable-calendar>
<enable-addressbook>true</enable-addressbook>
</record>
<record>
<uid>C*</uid>
<enable>true</enable>
- <partition-id>00003</partition-id>
<enable-calendar>true</enable-calendar>
<enable-addressbook>true</enable-addressbook>
<auto-schedule>true</auto-schedule>
@@ -102,17 +94,14 @@
<record>
<uid>5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1</uid>
<enable>true</enable>
- <partition-id>00001</partition-id>
</record>
<record>
<uid>543D28BA-F74F-4D5F-9243-B3E3A61171E5</uid>
<enable>true</enable>
- <partition-id>00002</partition-id>
</record>
<record>
<uid>6A73326A-F781-47E7-A9F8-AF47364D4152</uid>
<enable>true</enable>
- <partition-id>00002</partition-id>
<enable-calendar>true</enable-calendar>
<enable-addressbook>true</enable-addressbook>
<auto-schedule>true</auto-schedule>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test.xml 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/augments-test.xml 2013-11-05 20:05:41 UTC (rev 11890)
@@ -42,12 +42,10 @@
<record>
<uid>5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1</uid>
<enable>true</enable>
- <partition-id>00001</partition-id>
</record>
<record>
<uid>543D28BA-F74F-4D5F-9243-B3E3A61171E5</uid>
<enable>true</enable>
- <partition-id>00002</partition-id>
</record>
<record>
<uid>6A73326A-F781-47E7-A9F8-AF47364D4152</uid>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/resources/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/resources/caldavd.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/resources/caldavd.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -175,7 +175,6 @@
Augments for the directory service records to add calendar specific attributes.
A variety of augment services are available for use.
- When using a partitioned server, a service that can be accessed from each host will be needed.
-->
<!-- XML File Augment Service -->
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
- <key>users</key>
- <array>
- <dict>
- <key>authorize-as</key>
- <dict>
- <key>allow</key>
- <true />
- <key>principals</key>
- <array>
- <string>all</string>
- </array>
- </dict>
- <key>authorize-from</key>
- <array>
- <string>127.0.0.1</string>
- </array>
- <key>password</key>
- <string>alice</string>
- <key>username</key>
- <string>alice</string>
- </dict>
- </array>
- </dict>
-</plist>
Deleted: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers2.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers2.plist 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/sudoers2.plist 2013-11-05 20:05:41 UTC (rev 11890)
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
- <key>users</key>
- <array>
- <dict>
- <key>authorize-as</key>
- <dict>
- <key>allow</key>
- <true />
- <key>principals</key>
- <array>
- <string>all</string>
- </array>
- </dict>
- <key>authorize-from</key>
- <array>
- <string>127.0.0.1</string>
- </array>
- <key>password</key>
- <string>alice</string>
- <key>username</key>
- <string>alice</string>
- </dict>
- <dict>
- <key>authorize-as</key>
- <dict>
- <key>allow</key>
- <true />
- <key>principals</key>
- <array>
- <string>all</string>
- </array>
- </dict>
- <key>authorize-from</key>
- <array>
- <string>127.0.0.1</string>
- </array>
- <key>password</key>
- <string>bob</string>
- <key>username</key>
- <string>bob</string>
- </dict>
- </array>
- </dict>
-</plist>
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_augment.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_augment.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_augment.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -15,7 +15,7 @@
##
from twistedcaldav.test.util import TestCase
-from twistedcaldav.directory.augment import AugmentXMLDB, AugmentSqliteDB,\
+from twistedcaldav.directory.augment import AugmentXMLDB, AugmentSqliteDB, \
AugmentPostgreSQLDB, AugmentRecord
from twistedcaldav.directory.directory import DirectoryService
from twisted.internet.defer import inlineCallbacks
@@ -32,46 +32,46 @@
xmlFileNormalization = os.path.join(os.path.dirname(__file__), "augments-normalization.xml")
testRecords = (
- {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "enabled":True, "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"6423F94A-6B76-4A3A-815B-D52CFD77935D", "enabled":True, "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"5A985493-EE2C-4665-94CF-4DFEA3A89500", "enabled":False, "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "enabled":True, "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "enabled":True, "partitionID":"00001", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"543D28BA-F74F-4D5F-9243-B3E3A61171E5", "enabled":True, "partitionID":"00002", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"6A73326A-F781-47E7-A9F8-AF47364D4152", "enabled":True, "partitionID":"00002", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"default"},
- {"uid":"C5BAADEE-6B35-4FD5-A98A-5DF6BBAAC47A", "enabled":True, "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"default"},
- {"uid":"8AB34DF9-0297-4BA3-AADB-DB557DDD21E7", "enabled":True, "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"accept-always"},
- {"uid":"FC674703-8008-4A77-B80E-0DB55A9CE620", "enabledForLogin":False,}, # Explicitly false
- {"uid":"B473DC32-1B0D-45EE-9BAC-DA878AE9CE74", "enabledForLogin":True,}, # Explicitly True
- {"uid":"9F2B176D-B3F5-483A-AA63-0A1FC6E6D54B", "enabledForLogin":True,}, # Default is True
+ {"uid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "enabled": True, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "6423F94A-6B76-4A3A-815B-D52CFD77935D", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "5A985493-EE2C-4665-94CF-4DFEA3A89500", "enabled": False, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "enabled": True, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "enabled": True, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "543D28BA-F74F-4D5F-9243-B3E3A61171E5", "enabled": True, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "6A73326A-F781-47E7-A9F8-AF47364D4152", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "default"},
+ {"uid": "C5BAADEE-6B35-4FD5-A98A-5DF6BBAAC47A", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "default"},
+ {"uid": "8AB34DF9-0297-4BA3-AADB-DB557DDD21E7", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "accept-always"},
+ {"uid": "FC674703-8008-4A77-B80E-0DB55A9CE620", "enabledForLogin": False, }, # Explicitly false
+ {"uid": "B473DC32-1B0D-45EE-9BAC-DA878AE9CE74", "enabledForLogin": True, }, # Explicitly True
+ {"uid": "9F2B176D-B3F5-483A-AA63-0A1FC6E6D54B", "enabledForLogin": True, }, # Default is True
)
testRecordWildcardDefault = (
- {"uid":"A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True, "partitionID":"00001", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"AA5F935F-3358-4510-A649-B391D63279F2", "enabled":True, "partitionID":"00001", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"ABF1A83B-1A29-4E04-BDC3-A6A66ECF27CA", "enabled":False, "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"BC22A734-5E41-4FB7-B5C1-51DC0656DC2F", "enabled":True, "partitionID":"00002", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"C6DEEBB1-E14A-47F2-98BA-7E3BB4353E3A", "enabled":True, "partitionID":"00003", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"accept-always"},
- {"uid":"AA859321-2C72-4974-ADCF-0CBA0C76F95D", "enabled":True, "partitionID":"00001", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"AB7C488B-9ED2-4265-881C-7E2E38A63584", "enabled":False, "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"BB0C0DA1-0545-45F6-8D08-917C554D93A4", "enabled":True, "partitionID":"00002", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False, "autoScheduleMode":"default"},
- {"uid":"CCD30AD3-582F-4682-8B65-2EDE92C5656E", "enabled":True, "partitionID":"00003", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":True, "autoScheduleMode":"accept-always"},
+ {"uid": "A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "AA5F935F-3358-4510-A649-B391D63279F2", "enabled": True, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "ABF1A83B-1A29-4E04-BDC3-A6A66ECF27CA", "enabled": False, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "BC22A734-5E41-4FB7-B5C1-51DC0656DC2F", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "C6DEEBB1-E14A-47F2-98BA-7E3BB4353E3A", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "accept-always"},
+ {"uid": "AA859321-2C72-4974-ADCF-0CBA0C76F95D", "enabled": True, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "AB7C488B-9ED2-4265-881C-7E2E38A63584", "enabled": False, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "BB0C0DA1-0545-45F6-8D08-917C554D93A4", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
+ {"uid": "CCD30AD3-582F-4682-8B65-2EDE92C5656E", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": True, "autoScheduleMode": "accept-always"},
)
testRecordTypeDefault = (
- ("locations", {"uid":"A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True, "partitionID":"00004", "enabledForCalendaring":True, "enabledForAddressBooks":False, "autoSchedule":True, "autoScheduleMode":"default"}),
- ("locations", {"uid":"AA5F935F-3358-4510-A649-B391D63279F2", "enabled":True, "partitionID":"00005", "enabledForCalendaring":True, "enabledForAddressBooks":False, "autoSchedule":True, "autoScheduleMode":"default"}),
- ("resources", {"uid":"A5318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True, "partitionID":"00006", "enabledForCalendaring":True, "enabledForAddressBooks":False, "autoSchedule":True, "autoScheduleMode":"default"}),
- ("resources", {"uid":"AA6F935F-3358-4510-A649-B391D63279F2", "enabled":True, "partitionID":"00007", "enabledForCalendaring":True, "enabledForAddressBooks":False, "autoSchedule":True, "autoScheduleMode":"default"}),
+ ("locations", {"uid": "A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
+ ("locations", {"uid": "AA5F935F-3358-4510-A649-B391D63279F2", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
+ ("resources", {"uid": "A5318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
+ ("resources", {"uid": "AA6F935F-3358-4510-A649-B391D63279F2", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": False, "autoSchedule": True, "autoScheduleMode": "default"}),
)
testAddRecords = (
- {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled":True, "partitionID":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False, "autoScheduleMode":"default"},
+ {"uid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled": True, "enabledForCalendaring": False, "enabledForAddressBooks": False, "autoSchedule": False, "autoScheduleMode": "default"},
)
testModifyRecords = (
- {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled":True, "partitionID":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False, "autoScheduleMode":"default"},
+ {"uid": "D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled": True, "enabledForCalendaring": True, "enabledForAddressBooks": True, "autoSchedule": False, "autoScheduleMode": "default"},
)
@@ -79,27 +79,31 @@
@inlineCallbacks
def _checkRecord(self, db, items, recordType=DirectoryService.recordType_users):
-
+
record = (yield db.getAugmentRecord(items["uid"], recordType))
self.assertTrue(record is not None, "Failed record uid: %s" % (items["uid"],))
-
- for k,v in items.iteritems():
- self.assertEqual(getattr(record, k), v, "Failed record uid: %s, attribute: %s" % (items["uid"], k, ))
+ for k, v in items.iteritems():
+ self.assertEqual(getattr(record, k), v, "Failed record uid: %s, attribute: %s" % (items["uid"], k,))
+
+
@inlineCallbacks
def _checkRecordExists(self, db, uid, recordType=DirectoryService.recordType_users):
-
+
record = (yield db.getAugmentRecord(uid, recordType))
self.assertTrue(record is not None, "Failed record uid: %s" % (uid,))
+
+
class AugmentTestsMixin(object):
def _db(self, dbpath=None):
raise NotImplementedError
+
@inlineCallbacks
def test_read(self):
-
+
dbpath = os.path.abspath(self.mktemp())
db = self._db(dbpath)
@@ -113,9 +117,10 @@
# in the DB
yield self._checkRecordExists(db, "D11F03A0-97EA-48AF-9A6C-FAC7F3975767")
+
@inlineCallbacks
def test_read_default(self):
-
+
dbpath = os.path.abspath(self.mktemp())
db = self._db(dbpath)
@@ -132,6 +137,7 @@
for item in testRecordWildcardDefault:
yield self._checkRecord(db, item)
+
@inlineCallbacks
def test_read_typed_default(self):
"""
@@ -159,7 +165,7 @@
@inlineCallbacks
def test_add_modify(self):
-
+
dbpath = os.path.abspath(self.mktemp())
db = self._db(dbpath)
@@ -195,11 +201,13 @@
yield self._checkRecord(newdb, item)
yield self._checkRecord(newdb, testModifyRecords[0])
+
+
class AugmentXMLTests(AugmentTests):
@inlineCallbacks
def test_read(self):
-
+
db = AugmentXMLDB((xmlFile,))
for item in testRecords:
@@ -209,9 +217,10 @@
# in the DB
yield self._checkRecordExists(db, "D11F03A0-97EA-48AF-9A6C-FAC7F3975767")
+
@inlineCallbacks
def test_read_default(self):
-
+
db = AugmentXMLDB((xmlFileDefault,))
for item in testRecords:
@@ -220,8 +229,9 @@
for item in testRecordWildcardDefault:
yield self._checkRecord(db, item)
+
def test_parseErrors(self):
-
+
db = {}
self.assertRaises(RuntimeError, XMLAugmentsParser, cStringIO.StringIO(""), db)
self.assertRaises(RuntimeError, XMLAugmentsParser, cStringIO.StringIO("""<?xml version="1.0" encoding="utf-8"?>
@@ -249,13 +259,14 @@
</record>
"""), db)
+
@inlineCallbacks
def test_add_modify(self):
-
+
# Duplicate file as we will change it
newxmlfile = FilePath(self.mktemp())
FilePath(xmlFile).copyTo(newxmlfile)
-
+
db = AugmentXMLDB((newxmlfile.path,))
for item in testRecords:
@@ -283,6 +294,7 @@
yield self._checkRecord(newdb, item)
yield self._checkRecord(newdb, testModifyRecords[0])
+
def test_shouldReparse(self):
"""
Verify that a change to the file will get noticed
@@ -294,6 +306,7 @@
newxmlfile.setContent("") # Change the file
self.assertTrue(db._shouldReparse([newxmlfile.path])) # Need to parse
+
def test_refresh(self):
"""
Ensure that a refresh without any file changes doesn't zero out the
@@ -304,6 +317,7 @@
dbxml.refresh()
self.assertEquals(keys, dbxml.db.keys())
+
def uidsFromFile(self, filename):
"""
Return all uids from the augments xml file
@@ -316,6 +330,7 @@
uid = record_node.find(xmlaugmentsparser.ELEMENT_UID).text
yield uid
+
def test_normalize(self):
"""
Ensure augment uids are normalized upon opening
@@ -328,11 +343,15 @@
uids = list(self.uidsFromFile(newxmlfile.path))
self.assertEquals(uids, ['AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA'])
+
+
class AugmentSqliteTests(AugmentTests, AugmentTestsMixin):
def _db(self, dbpath=None):
return AugmentSqliteDB(dbpath if dbpath else os.path.abspath(self.mktemp()))
+
+
class AugmentPostgreSQLTests(AugmentTests, AugmentTestsMixin):
def _db(self, dbpath=None):
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_ldapdirectory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_ldapdirectory.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/test/test_ldapdirectory.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -276,6 +276,7 @@
entry["expected"]
)
+
class StubList(object):
def __init__(self, wrapper):
self.ldap = wrapper
@@ -293,6 +294,7 @@
self.allResults = self.ldap.search_s(self.base, self.scope,
self.filterstr, attrlist=self.attrList)
+
class StubAsync(object):
def List(self, wrapper):
return StubList(wrapper)
@@ -304,7 +306,6 @@
whatever you have previously called addTestResults( ) with.
"""
-
def __init__(self, actual, records):
self.actual = actual
self.async = StubAsync()
@@ -587,9 +588,8 @@
"readOnlyProxyAttr": "read-only-proxy",
"autoAcceptGroupAttr": None,
},
- "partitionSchema": {
+ "poddingSchema": {
"serverIdAttr": "server-id", # maps to augments server-id
- "partitionIdAttr": "partition-id", # maps to augments partition-id
},
}
)
@@ -803,9 +803,8 @@
"readOnlyProxyAttr": None,
"autoAcceptGroupAttr": None,
},
- "partitionSchema": {
+ "poddingSchema": {
"serverIdAttr": "server-id", # maps to augments server-id
- "partitionIdAttr": "partition-id", # maps to augments partition-id
},
}
)
@@ -1021,9 +1020,8 @@
"readOnlyProxyAttr": None,
"autoAcceptGroupAttr": None,
},
- "partitionSchema": {
+ "poddingSchema": {
"serverIdAttr": "server-id", # maps to augments server-id
- "partitionIdAttr": "partition-id", # maps to augments partition-id
},
}
)
@@ -1235,9 +1233,8 @@
"readOnlyProxyAttr": None,
"autoAcceptGroupAttr": None,
},
- "partitionSchema": {
+ "poddingSchema": {
"serverIdAttr": "server-id", # maps to augments server-id
- "partitionIdAttr": "partition-id", # maps to augments partition-id
},
}
)
@@ -1295,7 +1292,6 @@
self.assertEquals(record.firstName, 'Amanda')
self.assertEquals(record.lastName, 'Test')
self.assertEquals(record.serverID, None)
- self.assertEquals(record.partitionID, None)
self.assertFalse(record.enabledForCalendaring)
# User with enabled-for-calendaring specified
@@ -1325,13 +1321,11 @@
'apple-generateduid': [guid],
'cn': ['Amanda Test'],
'server-id' : ["test-server-id"],
- 'partition-id' : ["test-partition-id"],
}
record = self.service._ldapResultToRecord(dn, attrs,
self.service.recordType_users)
self.assertEquals(record.serverID, "test-server-id")
- self.assertEquals(record.partitionID, "test-partition-id")
# User missing guidAttr
@@ -1471,7 +1465,6 @@
self.assertFalse(record.autoSchedule)
self.assertEquals(record.autoAcceptGroup, "")
-
# Now switch off the resourceInfoAttr and switch to individual
# attributes...
self.service.resourceSchema = {
@@ -1625,7 +1618,6 @@
self.assertFalse(self.service.isAllowedByRestrictToGroup(dn, attrs))
-
@inlineCallbacks
def test_groupMembershipAliases(self):
"""
@@ -1680,7 +1672,6 @@
)
-
def test_splitIntoBatches(self):
self.setupService(self.nestedUsingDifferentAttributeUsingDN)
# Data is perfect multiple of size
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/xmlaugmentsparser.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/xmlaugmentsparser.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/directory/xmlaugmentsparser.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -30,38 +30,36 @@
log = Logger()
-ELEMENT_AUGMENTS = "augments"
-ELEMENT_RECORD = "record"
+ELEMENT_AUGMENTS = "augments"
+ELEMENT_RECORD = "record"
-ELEMENT_UID = "uid"
-ELEMENT_ENABLE = "enable"
-ELEMENT_SERVERID = "server-id"
-ELEMENT_PARTITIONID = "partition-id"
-ELEMENT_HOSTEDAT = "hosted-at" # Backwards compatibility
-ELEMENT_ENABLECALENDAR = "enable-calendar"
+ELEMENT_UID = "uid"
+ELEMENT_ENABLE = "enable"
+ELEMENT_SERVERID = "server-id"
+ELEMENT_PARTITIONID = "partition-id" # Backwards compatibility
+ELEMENT_HOSTEDAT = "hosted-at" # Backwards compatibility
+ELEMENT_ENABLECALENDAR = "enable-calendar"
ELEMENT_ENABLEADDRESSBOOK = "enable-addressbook"
-ELEMENT_ENABLELOGIN = "enable-login"
-ELEMENT_AUTOSCHEDULE = "auto-schedule"
+ELEMENT_ENABLELOGIN = "enable-login"
+ELEMENT_AUTOSCHEDULE = "auto-schedule"
ELEMENT_AUTOSCHEDULE_MODE = "auto-schedule-mode"
-ELEMENT_AUTOACCEPTGROUP = "auto-accept-group"
+ELEMENT_AUTOACCEPTGROUP = "auto-accept-group"
-ATTRIBUTE_REPEAT = "repeat"
+ATTRIBUTE_REPEAT = "repeat"
-VALUE_TRUE = "true"
-VALUE_FALSE = "false"
+VALUE_TRUE = "true"
+VALUE_FALSE = "false"
ELEMENT_AUGMENTRECORD_MAP = {
- ELEMENT_UID: "uid",
- ELEMENT_ENABLE: "enabled",
- ELEMENT_SERVERID: "serverID",
- ELEMENT_PARTITIONID: "partitionID",
- ELEMENT_HOSTEDAT: "partitionID", # Backwards compatibility
- ELEMENT_ENABLECALENDAR: "enabledForCalendaring",
+ ELEMENT_UID: "uid",
+ ELEMENT_ENABLE: "enabled",
+ ELEMENT_SERVERID: "serverID",
+ ELEMENT_ENABLECALENDAR: "enabledForCalendaring",
ELEMENT_ENABLEADDRESSBOOK: "enabledForAddressBooks",
- ELEMENT_ENABLELOGIN: "enabledForLogin",
- ELEMENT_AUTOSCHEDULE: "autoSchedule",
+ ELEMENT_ENABLELOGIN: "enabledForLogin",
+ ELEMENT_AUTOSCHEDULE: "autoSchedule",
ELEMENT_AUTOSCHEDULE_MODE: "autoScheduleMode",
- ELEMENT_AUTOACCEPTGROUP: "autoAcceptGroup",
+ ELEMENT_AUTOACCEPTGROUP: "autoAcceptGroup",
}
class XMLAugmentsParser(object):
@@ -71,6 +69,7 @@
def __repr__(self):
return "<%s %r>" % (self.__class__.__name__, self.xmlFile)
+
def __init__(self, xmlFile, items):
self.items = items
@@ -84,13 +83,14 @@
self._parseXML(augments_node)
+
def _parseXML(self, rootnode):
"""
Parse the XML root node from the augments configuration document.
@param rootnode: the L{Element} to parse.
"""
for child in rootnode:
-
+
if child.tag != ELEMENT_RECORD:
raise RuntimeError("Unknown augment type: '%s' in augment file: '%s'" % (child.tag, self.xmlFile,))
@@ -98,7 +98,7 @@
fields = {}
for node in child:
-
+
if node.tag in (
ELEMENT_UID,
ELEMENT_SERVERID,
@@ -118,33 +118,35 @@
fields[node.tag] = node.text == VALUE_TRUE
else:
raise RuntimeError("Invalid element '%s' in augment file: '%s'" % (node.tag, self.xmlFile,))
-
+
# Must have at least a uid
if ELEMENT_UID not in fields:
raise RuntimeError("Invalid record '%s' without a uid in augment file: '%s'" % (child, self.xmlFile,))
-
+
if repeat > 1:
- for i in xrange(1, repeat+1):
+ for i in xrange(1, repeat + 1):
self.buildRecord(fields, i)
else:
self.buildRecord(fields)
-
+
+
def buildRecord(self, fields, count=None):
-
+
from twistedcaldav.directory.augment import AugmentRecord
def expandCount(value, count):
-
+
if type(value) in types.StringTypes:
return value % (count,) if count and "%" in value else value
elif type(value) == set:
return set([item % (count,) if count and "%" in item else item for item in value])
else:
return value
-
+
actualFields = {}
- for k,v in fields.iteritems():
- actualFields[ELEMENT_AUGMENTRECORD_MAP[k]] = expandCount(v, count)
+ for k, v in fields.iteritems():
+ if k in ELEMENT_AUGMENTRECORD_MAP:
+ actualFields[ELEMENT_AUGMENTRECORD_MAP[k]] = expandCount(v, count)
record = AugmentRecord(**actualFields)
self.items[record.uid] = record
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twistedcaldav/stdconfig.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -156,9 +156,8 @@
"resourceInfoAttr": None, # contains location/resource info
"autoAcceptGroupAttr": None, # auto accept group
},
- "partitionSchema": {
+ "poddingSchema": {
"serverIdAttr": None, # maps to augments server-id
- "partitionIdAttr": None, # maps to augments partition-id
},
},
}
@@ -806,12 +805,11 @@
# Support multiple hosts within a domain
#
"Servers" : {
- "Enabled": False, # Multiple servers/partitions enabled or not
+ "Enabled": False, # Multiple servers enabled or not
"ConfigFile": "localservers.xml", # File path for server information
- "MaxClients": 5, # Pool size for connections to each partition
+ "MaxClients": 5, # Pool size for connections to between servers
"InboxName": "podding", # Name for top-level inbox resource
},
- "ServerPartitionID": "", # Unique ID for this server's partition instance.
#
# Performance tuning
@@ -1044,19 +1042,24 @@
if self._configFileName:
configDict = self._parseConfigFromFile(self._configFileName)
configDict = ConfigDict(configDict)
- # Now check for Includes and parse and add each of those
- if "Includes" in configDict:
- configRoot = os.path.join(configDict.ServerRoot, configDict.ConfigRoot)
- for include in configDict.Includes:
- # Includes are not relative to ConfigRoot
- path = _expandPath(fullServerPath(configRoot, include))
- if os.path.exists(path):
- additionalDict = ConfigDict(self._parseConfigFromFile(path))
- if additionalDict:
- log.info("Adding configuration from file: '%s'" % (path,))
- mergeData(configDict, additionalDict)
- else:
- log.debug("Missing configuration file: '%s'" % (path,))
+
+ def _loadIncludes(parentDict):
+ # Now check for Includes and parse and add each of those
+ if "Includes" in parentDict:
+ configRoot = os.path.join(parentDict.ServerRoot, parentDict.ConfigRoot)
+ for include in parentDict.Includes:
+ # Includes are not relative to ConfigRoot
+ path = _expandPath(fullServerPath(configRoot, include))
+ if os.path.exists(path):
+ additionalDict = ConfigDict(self._parseConfigFromFile(path))
+ if additionalDict:
+ self.includedFiles.append(path)
+ _loadIncludes(additionalDict)
+ mergeData(parentDict, additionalDict)
+ else:
+ self.missingFiles.append(path)
+
+ _loadIncludes(configDict)
return configDict
@@ -1520,8 +1523,7 @@
from txdav.caldav.datastore.scheduling.ischedule.localservers import Servers
if configDict.Servers.Enabled:
Servers.load()
- Servers.getThisServer().installReverseProxies(
- configDict.ServerPartitionID,
+ Servers.installReverseProxies(
configDict.Servers.MaxClients,
)
else:
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/addressmapping.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/addressmapping.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/addressmapping.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -53,7 +53,7 @@
@inlineCallbacks
def getCalendarUser(self, cuaddr, principal):
- # If we have a principal always treat the user as local or partitioned
+ # If we have a principal always treat the user as local
if principal:
returnValue(calendarUserFromPrincipal(cuaddr, principal))
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/delivery.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/delivery.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/delivery.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -26,8 +26,7 @@
from twistedcaldav.config import config
from txdav.base.propertystore.base import PropertyName
-from txdav.caldav.datastore.scheduling.cuaddress import LocalCalendarUser, RemoteCalendarUser, \
- PartitionedCalendarUser, OtherServerCalendarUser
+from txdav.caldav.datastore.scheduling.cuaddress import LocalCalendarUser, RemoteCalendarUser, OtherServerCalendarUser
from txdav.caldav.datastore.scheduling.delivery import DeliveryService
from txdav.caldav.datastore.scheduling.freebusy import processAvailabilityFreeBusy, \
generateFreeBusyInfo, buildFreeBusyResult
@@ -99,7 +98,7 @@
uid = self.scheduler.calendar.resourceUID()
organizerPrincipal = None
- if type(self.scheduler.organizer) in (LocalCalendarUser, PartitionedCalendarUser, OtherServerCalendarUser,):
+ if type(self.scheduler.organizer) in (LocalCalendarUser, OtherServerCalendarUser,):
organizerPrincipal = self.scheduler.organizer.principal.uid
for recipient in self.recipients:
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-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/caldav/scheduler.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -136,7 +136,7 @@
# Map recipient to their inbox
inbox = None
if principal.calendarsEnabled():
- if principal.locallyHosted():
+ if principal.thisServer():
recipient_home = yield self.txn.calendarHomeWithUID(principal.uid, create=True)
if recipient_home:
inbox = (yield recipient_home.calendarWithName("inbox"))
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/cuaddress.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/cuaddress.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/cuaddress.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -21,7 +21,6 @@
__all__ = [
"LocalCalendarUser",
- "PartitionedCalendarUser",
"OtherServerCalendarUser",
"RemoteCalendarUser",
"EmailCalendarUser",
@@ -53,19 +52,6 @@
-class PartitionedCalendarUser(CalendarUser):
-
- def __init__(self, cuaddr, principal):
- self.cuaddr = cuaddr
- self.principal = principal
- self.serviceType = DeliveryService.serviceType_ischedule
-
-
- def __str__(self):
- return "Partitioned calendar user: %s" % (self.cuaddr,)
-
-
-
class OtherServerCalendarUser(CalendarUser):
def __init__(self, cuaddr, principal):
@@ -145,9 +131,7 @@
Get the appropriate calendar user address class for the provided principal.
"""
- if principal.locallyHosted():
+ if principal.thisServer():
return LocalCalendarUser(recipient, principal, inbox)
- elif principal.thisServer():
- return PartitionedCalendarUser(recipient, principal)
else:
return OtherServerCalendarUser(recipient, principal)
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/implicit.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/implicit.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -29,7 +29,7 @@
from txdav.caldav.datastore.scheduling import addressmapping
from txdav.caldav.datastore.scheduling.caldav.scheduler import CalDAVScheduler
from txdav.caldav.datastore.scheduling.cuaddress import InvalidCalendarUser, \
- LocalCalendarUser, PartitionedCalendarUser, OtherServerCalendarUser, \
+ LocalCalendarUser, OtherServerCalendarUser, \
normalizeCUAddr
from txdav.caldav.datastore.scheduling.icaldiff import iCalDiff
from txdav.caldav.datastore.scheduling.itip import iTipGenerator, iTIPRequestStatus
@@ -251,7 +251,7 @@
# to create new scheduling resources.
if self.action == "create":
if self.organizerPrincipal and not self.organizerPrincipal.enabledAsOrganizer():
- log.error("ORGANIZER not allowed to be an Organizer: %s" % (self.organizer,))
+ log.error("ORGANIZER not allowed to be an Organizer: {organizer}", organizer=self.organizer)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "organizer-allowed"),
@@ -427,7 +427,7 @@
self.organizer = self.calendar.validOrganizerForScheduling()
except ValueError:
# We have different ORGANIZERs in the same iCalendar object - this is an error
- log.error("Only one ORGANIZER is allowed in an iCalendar object:\n%s" % (self.calendar,))
+ log.error("Only one ORGANIZER is allowed in an iCalendar object:\n{calendar}", calendar=self.calendar)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "single-organizer"),
@@ -462,7 +462,7 @@
# Check for matching resource somewhere else in the home
foundElsewhere = (yield self.calendar_home.hasCalendarResourceUIDSomewhereElse(self.uid, check_resource, mode))
if foundElsewhere is not None:
- log.debug("Implicit - found component with same UID in a different collection: %s" % (check_resource,))
+ log.debug("Implicit - found component with same UID in a different collection: {resource}", resource=check_resource)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "unique-scheduling-object-resource"),
@@ -531,7 +531,7 @@
# Check for a delete
if self.action == "remove":
- log.debug("Implicit - organizer '%s' is removing UID: '%s'" % (self.organizer, self.uid))
+ log.debug("Implicit - organizer '{organizer}' is removing UID: '{uid}'", organizer=self.organizer, uid=self.uid)
self.oldcalendar = self.calendar
# Cancel all attendees
@@ -557,16 +557,16 @@
no_change, self.changed_rids, self.needs_action_rids, reinvites, recurrence_reschedule = self.isOrganizerChangeInsignificant()
if no_change:
if reinvites:
- log.debug("Implicit - organizer '%s' is re-inviting UID: '%s', attendees: %s" % (self.organizer, self.uid, ", ".join(reinvites)))
+ log.debug("Implicit - organizer '{organizer}' is re-inviting UID: '{uid}', attendees: {attendees}", organizer=self.organizer, uid=self.uid, attendees=", ".join(reinvites))
self.reinvites = reinvites
else:
# Nothing to do
- log.debug("Implicit - organizer '%s' is modifying UID: '%s' but change is not significant" % (self.organizer, self.uid))
+ log.debug("Implicit - organizer '{organizer}' is modifying UID: '{uid}' but change is not significant", organizer=self.organizer, uid=self.uid)
returnValue(None)
else:
# Do not change PARTSTATs for a split operation
if self.split_details is None:
- log.debug("Implicit - organizer '%s' is modifying UID: '%s'" % (self.organizer, self.uid))
+ log.debug("Implicit - organizer '{organizer}' is modifying UID: '{uid}'", organizer=self.organizer, uid=self.uid)
for rid in self.needs_action_rids:
comp = self.calendar.overriddenComponent(rid)
@@ -587,7 +587,7 @@
attendee.setParameter("PARTSTAT", "NEEDS-ACTION")
else:
- log.debug("Implicit - organizer '%s' is splitting UID: '%s'" % (self.organizer, self.uid))
+ log.debug("Implicit - organizer '{organizer}' is splitting UID: '{uid}'", organizer=self.organizer, uid=self.uid)
# Check for removed attendees
if not recurrence_reschedule:
@@ -601,10 +601,10 @@
elif self.action == "create":
if self.split_details is None:
- log.debug("Implicit - organizer '%s' is creating UID: '%s'" % (self.organizer, self.uid))
+ log.debug("Implicit - organizer '{organizer}' is creating UID: '{uid}'", organizer=self.organizer, uid=self.uid)
self.coerceAttendeesPartstatOnCreate()
else:
- log.debug("Implicit - organizer '%s' is creating a split UID: '%s'" % (self.organizer, self.uid))
+ log.debug("Implicit - organizer '{organizer}' is creating a split UID: '{uid}'", organizer=self.organizer, uid=self.uid)
self.needs_sequence_change = False
# Always set RSVP=TRUE for any NEEDS-ACTION
@@ -698,7 +698,7 @@
oldOrganizer = self.oldcalendar.getOrganizer()
newOrganizer = self.calendar.getOrganizer()
if oldOrganizer != newOrganizer:
- log.error("Cannot change ORGANIZER: UID:%s" % (self.uid,))
+ log.error("Cannot change ORGANIZER: UID:{uid}", uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-organizer-change"),
@@ -906,7 +906,7 @@
if cuaddr not in coerced:
attendeePrincipal = self.calendar_home.directoryService().recordWithCalendarUserAddress(cuaddr)
attendeeAddress = (yield addressmapping.mapper.getCalendarUser(cuaddr, attendeePrincipal))
- local_attendee = type(attendeeAddress) in (LocalCalendarUser, PartitionedCalendarUser, OtherServerCalendarUser,)
+ local_attendee = type(attendeeAddress) in (LocalCalendarUser, OtherServerCalendarUser,)
coerced[cuaddr] = local_attendee
if coerced[cuaddr]:
attendee.removeParameter("SCHEDULE-AGENT")
@@ -977,7 +977,7 @@
scheduler = self.makeScheduler()
# Do the PUT processing
- log.info("Implicit CANCEL - organizer: '%s' to attendee: '%s', UID: '%s', RIDs: '%s'" % (self.organizer, attendee, self.uid, rids))
+ log.info("Implicit CANCEL - organizer: '{organizer}' to attendee: '{attendee}', UID: '{uid}', RIDs: '{rids}'", organizer=self.organizer, attendee=attendee, uid=self.uid, rids=rids)
response = (yield scheduler.doSchedulingViaPUT(self.originator, (attendee,), itipmsg, internal_request=True, suppress_refresh=self.suppress_refresh))
self.handleSchedulingResponse(response, True)
@@ -1034,7 +1034,7 @@
scheduler = self.makeScheduler()
# Do the PUT processing
- log.info("Implicit REQUEST - organizer: '%s' to attendee: '%s', UID: '%s'" % (self.organizer, attendee, self.uid,))
+ log.info("Implicit REQUEST - organizer: '{organizer}' to attendee: '{attendee}', UID: '{uid}'", organizer=self.organizer, attendee=attendee, uid=self.uid)
response = (yield scheduler.doSchedulingViaPUT(self.originator, (attendee,), itipmsg, internal_request=True, suppress_refresh=self.suppress_refresh))
self.handleSchedulingResponse(response, True)
@@ -1069,19 +1069,19 @@
if self.action == "remove":
if self.calendar.hasPropertyValueInAllComponents(Property("STATUS", "CANCELLED")):
- log.debug("Implicit - attendee '%s' is removing cancelled UID: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is removing cancelled UID: '{uid}'", attendee=self.attendee, uid=self.uid)
# Nothing else to do
elif doScheduling:
# If attendee is already marked as declined in all components - nothing to do
attendees = self.calendar.getAttendeeProperties((self.attendee,))
if all([attendee.parameterValue("PARTSTAT", "NEEDS-ACTION") == "DECLINED" for attendee in attendees]):
- log.debug("Implicit - attendee '%s' is removing fully declined UID: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is removing fully declined UID: '{uid}'", attendee=self.attendee, uid=self.uid)
# Nothing else to do
else:
- log.debug("Implicit - attendee '%s' is cancelling UID: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is cancelling UID: '{uid}'", attendee=self.attendee, uid=self.uid)
yield self.scheduleCancelWithOrganizer()
else:
- log.debug("Implicit - attendee '%s' is removing UID without server scheduling: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is removing UID without server scheduling: '{uid}'", attendee=self.attendee, uid=self.uid)
# Nothing else to do
returnValue(None)
@@ -1092,7 +1092,7 @@
oldOrganizer = self.oldcalendar.getOrganizer()
newOrganizer = self.calendar.getOrganizer()
if oldOrganizer != newOrganizer:
- log.error("Cannot change ORGANIZER: UID:%s" % (self.uid,))
+ log.error("Cannot change ORGANIZER: UID:{uid}", uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-attendee-change"),
@@ -1107,7 +1107,7 @@
# If Organizer copy exists we cannot allow SCHEDULE-AGENT=CLIENT or NONE
if not doScheduling:
- log.error("Attendee '%s' is not allowed to change SCHEDULE-AGENT on organizer: UID:%s" % (self.attendeePrincipal, self.uid,))
+ log.error("Attendee '{attendee}' is not allowed to change SCHEDULE-AGENT on organizer: UID:{uid}", attendee=self.attendeePrincipal, uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-attendee-change"),
@@ -1121,11 +1121,11 @@
if not changeAllowed:
if self.calendar.hasPropertyValueInAllComponents(Property("STATUS", "CANCELLED")):
- log.debug("Attendee '%s' is creating CANCELLED event for mismatched UID: '%s' - removing entire event" % (self.attendee, self.uid,))
+ log.debug("Attendee '{attendee}' is creating CANCELLED event for mismatched UID: '{uid}' - removing entire event", attendee=self.attendee, uid=self.uid)
self.return_status = ImplicitScheduler.STATUS_ORPHANED_EVENT
returnValue(None)
else:
- log.error("Attendee '%s' is not allowed to make an unauthorized change to an organized event: UID:%s" % (self.attendeePrincipal, self.uid,))
+ log.error("Attendee '{attendee}' is not allowed to make an unauthorized change to an organized event: UID:{uid}", attendee=self.attendeePrincipal, uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-attendee-change"),
@@ -1135,21 +1135,21 @@
# Check that the return calendar actually has any components left - this can happen if a cancelled
# component is removed and replaced by another cancelled or invalid one
if self.calendar.mainType() is None:
- log.debug("Attendee '%s' is replacing CANCELLED event: '%s' - removing entire event" % (self.attendee, self.uid,))
+ log.debug("Attendee '{attendee}' is replacing CANCELLED event: '{uid}' - removing entire event", attendee=self.attendee, uid=self.uid)
self.return_status = ImplicitScheduler.STATUS_ORPHANED_EVENT
returnValue(None)
if not doITipReply:
- log.debug("Implicit - attendee '%s' is updating UID: '%s' but change is not significant" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is updating UID: '{uid}' but change is not significant", attendee=self.attendee, uid=self.uid)
returnValue(self.return_calendar)
- log.debug("Attendee '%s' is allowed to update UID: '%s' with local organizer '%s'" % (self.attendee, self.uid, self.organizer))
+ log.debug("Attendee '{attendee}' is allowed to update UID: '{uid}' with local organizer '{organizer}'", attendee=self.attendee, uid=self.uid, organizer=self.organizer)
elif isinstance(self.organizerAddress, LocalCalendarUser):
# If Organizer copy does not exists we cannot allow SCHEDULE-AGENT=SERVER
if doScheduling:
# Check to see whether all instances are CANCELLED
if self.calendar.hasPropertyValueInAllComponents(Property("STATUS", "CANCELLED")):
- log.debug("Attendee '%s' is creating CANCELLED event for missing UID: '%s' - removing entire event" % (self.attendee, self.uid,))
+ log.debug("Attendee '{attendee}' is creating CANCELLED event for missing UID: '{uid}' - removing entire event", attendee=self.attendee, uid=self.uid)
self.return_status = ImplicitScheduler.STATUS_ORPHANED_CANCELLED_EVENT
returnValue(None)
else:
@@ -1157,25 +1157,25 @@
if self.oldcalendar:
oldScheduling = self.oldcalendar.getOrganizerScheduleAgent()
if not oldScheduling:
- log.error("Attendee '%s' is not allowed to set SCHEDULE-AGENT=SERVER on organizer: UID:%s" % (self.attendeePrincipal, self.uid,))
+ log.error("Attendee '{attendee}' is not allowed to set SCHEDULE-AGENT=SERVER on organizer: UID:{uid}", attendee=self.attendeePrincipal, uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-attendee-change"),
"Attendee cannot change organizer state",
))
- log.debug("Attendee '%s' is not allowed to update UID: '%s' - missing organizer copy - removing entire event" % (self.attendee, self.uid,))
+ log.debug("Attendee '{attendee}' is not allowed to update UID: '{uid}' - missing organizer copy - removing entire event", attendee=self.attendee, uid=self.uid)
self.return_status = ImplicitScheduler.STATUS_ORPHANED_EVENT
returnValue(None)
else:
- log.debug("Implicit - attendee '%s' is modifying UID without server scheduling: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is modifying UID without server scheduling: '{uid}'", attendee=self.attendee, uid=self.uid)
# Nothing else to do
returnValue(None)
elif isinstance(self.organizerAddress, InvalidCalendarUser):
# We will allow the attendee to do anything in this case, but we will mark the organizer
# with an schedule-status error
- log.debug("Attendee '%s' is allowed to update UID: '%s' with invalid organizer '%s'" % (self.attendee, self.uid, self.organizer))
+ log.debug("Attendee '{attendee}' is allowed to update UID: '{uid}' with invalid organizer '{organizer}'", attendee=self.attendee, uid=self.uid, organizer=self.organizer)
if doScheduling:
self.calendar.setParameterToValueForPropertyWithValue(
"SCHEDULE-STATUS",
@@ -1189,14 +1189,14 @@
# to make any change they like as we cannot verify what is reasonable. In reality
# we ought to be comparing the Attendee changes against the attendee's own copy
# and restrict changes based on that when the organizer's copy is not available.
- log.debug("Attendee '%s' is allowed to update UID: '%s' with remote organizer '%s'" % (self.attendee, self.uid, self.organizer))
+ log.debug("Attendee '{attendee}' is allowed to update UID: '{uid}' with remote organizer '{organizer}'", attendee=self.attendee, uid=self.uid, organizer=self.organizer)
changedRids = None
if doScheduling:
- log.debug("Implicit - attendee '%s' is updating UID: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is updating UID: '{uid}'", attendee=self.attendee, uid=self.uid)
yield self.scheduleWithOrganizer(changedRids)
else:
- log.debug("Implicit - attendee '%s' is updating UID without server scheduling: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' is updating UID without server scheduling: '{uid}'", attendee=self.attendee, uid=self.uid)
# Nothing else to do
@@ -1205,7 +1205,7 @@
if self.action == "remove":
# Nothing else to do
- log.debug("Implicit - missing attendee is removing UID without server scheduling: '%s'" % (self.uid,))
+ log.debug("Implicit - missing attendee is removing UID without server scheduling: '{uid}'", uid=self.uid)
else:
# Make sure ORGANIZER is not changed if originally SCHEDULE-AGENT=SERVER
@@ -1214,7 +1214,7 @@
oldOrganizer = self.oldcalendar.getOrganizer()
newOrganizer = self.calendar.getOrganizer()
if oldOrganizer != newOrganizer and self.oldcalendar.getOrganizerScheduleAgent():
- log.error("Cannot change ORGANIZER: UID:%s" % (self.uid,))
+ log.error("Cannot change ORGANIZER: UID:{uid}", uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-attendee-change"),
@@ -1223,7 +1223,7 @@
# Never allow a missing attendee with a locally hosted organizer
if isinstance(self.organizerAddress, LocalCalendarUser):
- log.error("Cannot remove ATTENDEE: UID:%s" % (self.uid,))
+ log.error("Cannot remove ATTENDEE: UID:{uid}", uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-attendee-change"),
@@ -1232,7 +1232,7 @@
# We will allow the attendee to do anything in this case, but we will mark the organizer
# with an schedule-status error and schedule-agent none
- log.debug("Missing attendee is allowed to update UID: '%s' with invalid organizer '%s'" % (self.uid, self.organizer))
+ log.debug("Missing attendee is allowed to update UID: '{uid}' with invalid organizer '{organizer}'", uid=self.uid, organizer=self.organizer)
# Check SCHEDULE-AGENT and coerce SERVER to NONE
if self.calendar.getOrganizerScheduleAgent():
@@ -1243,14 +1243,14 @@
def checkOrganizerScheduleAgent(self):
is_server = self.calendar.getOrganizerScheduleAgent()
- local_organizer = type(self.organizerAddress) in (LocalCalendarUser, PartitionedCalendarUser, OtherServerCalendarUser,)
+ local_organizer = type(self.organizerAddress) in (LocalCalendarUser, OtherServerCalendarUser,)
if config.Scheduling.iMIP.Enabled and self.organizerAddress.cuaddr.lower().startswith("mailto:"):
return is_server
if not config.Scheduling.iSchedule.Enabled and not local_organizer and is_server:
# Coerce ORGANIZER to SCHEDULE-AGENT=NONE
- log.debug("Attendee '%s' is not allowed to use SCHEDULE-AGENT=SERVER on organizer: UID:%s" % (self.attendeePrincipal, self.uid,))
+ log.debug("Attendee '{attendee}' is not allowed to use SCHEDULE-AGENT=SERVER on organizer: UID:{uid}", attendee=self.attendeePrincipal, uid=self.uid)
self.calendar.setParameterToValueForPropertyWithValue("SCHEDULE-AGENT", "NONE", "ORGANIZER", None)
self.calendar.setParameterToValueForPropertyWithValue("SCHEDULE-STATUS", iTIPRequestStatus.NO_USER_SUPPORT_CODE, "ORGANIZER", None)
is_server = False
@@ -1272,8 +1272,8 @@
calendar_resource = (yield getCalendarObjectForRecord(self.calendar_home.transaction(), self.organizerPrincipal, self.uid))
if calendar_resource is not None:
self.organizer_calendar = (yield calendar_resource.componentForUser())
- elif type(self.organizerAddress) in (PartitionedCalendarUser, OtherServerCalendarUser,):
- # For partitioning where the organizer is on a different node, we will assume that the attendee's copy
+ elif type(self.organizerAddress) in (OtherServerCalendarUser,):
+ # For podding where the organizer is on a different node, we will assume that the attendee's copy
# of the event is up to date and "authoritative". So we pretend that is the organizer copy
self.organizer_calendar = self.oldcalendar
@@ -1290,7 +1290,7 @@
oldcalendar = self.organizer_calendar
oldcalendar.attendeesView((self.attendee,), onlyScheduleAgentServer=True)
if oldcalendar.mainType() is None:
- log.debug("Implicit - attendee '%s' cannot use an event they are not an attendee of, UID: '%s'" % (self.attendee, self.uid))
+ log.debug("Implicit - attendee '{attendee}' cannot use an event they are not an attendee of, UID: '{uid}'", attendee=self.attendee, uid=self.uid)
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "valid-attendee-change"),
@@ -1339,7 +1339,7 @@
def _gotResponse(response):
self.handleSchedulingResponse(response, False)
- log.info("Implicit %s - attendee: '%s' to organizer: '%s', UID: '%s'" % (action, self.attendee, self.organizer, self.uid,))
+ log.info("Implicit {action} - attendee: '{attendee}' to organizer: '{organizer}', UID: '{uid}'", action=action, attendee=self.attendee, organizer=self.organizer, uid=self.uid)
d = scheduler.doSchedulingViaPUT(self.originator, (self.organizer,), itipmsg, internal_request=True)
d.addCallback(_gotResponse)
return d
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/delivery.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/delivery.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/delivery.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -40,8 +40,7 @@
from twistedcaldav.ical import normalizeCUAddress, Component
from twistedcaldav.util import utf8String
-from txdav.caldav.datastore.scheduling.cuaddress import PartitionedCalendarUser, RemoteCalendarUser, \
- OtherServerCalendarUser
+from txdav.caldav.datastore.scheduling.cuaddress import RemoteCalendarUser, OtherServerCalendarUser
from txdav.caldav.datastore.scheduling.delivery import DeliveryService
from txdav.caldav.datastore.scheduling.ischedule.dkim import DKIMRequest, DKIMUtils
from txdav.caldav.datastore.scheduling.ischedule.remoteservers import IScheduleServerRecord
@@ -58,7 +57,7 @@
"""
Handles the sending of iSchedule scheduling messages. Used for both cross-domain scheduling,
-as well as internal partitioning or podding.
+as well as internal podding.
"""
__all__ = [
@@ -140,8 +139,6 @@
if isinstance(recipient, RemoteCalendarUser):
# Map the recipient's domain to a server
server = (yield self.serverForDomain(recipient.domain))
- elif isinstance(recipient, PartitionedCalendarUser):
- server = self._getServerForPartitionedUser(recipient)
elif isinstance(recipient, OtherServerCalendarUser):
server = self._getServerForOtherServerUser(recipient)
else:
@@ -186,23 +183,6 @@
yield DeferredList(deferreds)
- def _getServerForPartitionedUser(self, recipient):
-
- if not hasattr(self, "partitionedServers"):
- self.partitionedServers = {}
-
- partition = recipient.principal.partitionURI()
- if partition not in self.partitionedServers:
- self.partitionedServers[partition] = IScheduleServerRecord(
- uri=joinURL(partition, config.Servers.InboxName),
- unNormalizeAddresses=False,
- moreHeaders=[recipient.principal.server().secretHeader(), ],
- podding=True,
- )
-
- return self.partitionedServers[partition]
-
-
def _getServerForOtherServerUser(self, recipient):
if not hasattr(self, "otherServers"):
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/localservers.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/localservers.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/localservers.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -31,18 +31,12 @@
the principals across the whole domain need to be able to directly schedule each other and know of each others
existence. A common scenario would be a production server and a development/test server.
-Each server is identified by an id and url. The id is used when assigning principals to a specific server. Each
-server can also support multiple partitions, and each of those is identified by an id and url, with the id also
-being used to assign principals to a specific partition.
+Each server is identified by an id and url. The id is used when assigning principals to a specific server.
-These servers support the concept of "partitioning" and "podding".
+These servers support the concept of "podding".
-A "partitioned" service is one that spreads its
-users out across multiple stores and does reverse proxying of incoming requests to the appropriate partitioned host.
-All servers within the same partition have to be running the same version of the software etc.
-
A "podded" service is one where different groups of users are hosted on different servers, which may be of
-different versions etc. A "pod" may itself be "partitioned", but the partitioning is "invisible" to the outside world.
+different versions etc.
"""
__all__ = [
@@ -104,13 +98,31 @@
def getThisServer(self):
return self._thisServer
+
+ def installReverseProxies(self, maxClients):
+ """
+ Install a reverse proxy for each of the other servers in the "pod".
+
+ @param maxClients: maximum number of clients in the pool.
+ @type maxClients: C{int}
+ """
+
+ for server in self._servers.values():
+ if server.thisServer:
+ continue
+ installPool(
+ server.id,
+ server.uri,
+ maxClients,
+ )
+
Servers = ServersDB() # Global server DB
class Server(object):
"""
- Represents a server which may itself be partitioned.
+ Represents a server.
"""
def __init__(self):
@@ -120,8 +132,6 @@
self.ips = set()
self.allowed_from_ips = set()
self.shared_secret = None
- self.partitions = {}
- self.partitions_ips = set()
self.isImplicit = True
@@ -164,25 +174,12 @@
actual_ips.add(item)
self.allowed_from_ips = actual_ips
- for uri in self.partitions.values():
- parsed_uri = urlparse.urlparse(uri)
- try:
- ips = getIPsFromHost(parsed_uri.hostname)
- except socket.gaierror, e:
- msg = "Unable to lookup ip-addr for partition '%s': %s" % (parsed_uri.hostname, str(e))
- log.error(msg)
- if ignoreIPLookupFailures:
- ips = ()
- else:
- raise ValueError(msg)
- self.partitions_ips.update(ips)
-
def checkThisIP(self, ip):
"""
- Check that the passed in IP address corresponds to this server or one of its partitions.
+ Check that the passed in IP address corresponds to this server.
"""
- return (ip in self.ips) or (ip in self.partitions_ips)
+ return (ip in self.ips)
def hasAllowedFromIP(self):
@@ -218,38 +215,13 @@
return (SERVER_SECRET_HEADER, self.shared_secret,)
- def addPartition(self, id, uri):
- self.partitions[id] = uri
-
- def getPartitionURIForId(self, id):
- return self.partitions.get(id)
-
-
- def isPartitioned(self):
- return len(self.partitions) != 0
-
-
- def installReverseProxies(self, ownUID, maxClients):
-
- for partition, url in self.partitions.iteritems():
- if partition != ownUID:
- installPool(
- partition,
- url,
- maxClients,
- )
-
-
-
ELEMENT_SERVERS = "servers"
ELEMENT_SERVER = "server"
ELEMENT_ID = "id"
ELEMENT_URI = "uri"
ELEMENT_ALLOWED_FROM = "allowed-from"
ELEMENT_SHARED_SECRET = "shared-secret"
-ELEMENT_PARTITIONS = "partitions"
-ELEMENT_PARTITION = "partition"
ATTR_IMPLICIT = "implicit"
ATTR_VALUE_YES = "yes"
ATTR_VALUE_NO = "no"
@@ -286,39 +258,13 @@
server.allowed_from_ips.add(node.text)
elif node.tag == ELEMENT_SHARED_SECRET:
server.shared_secret = node.text
- elif node.tag == ELEMENT_PARTITIONS:
- ServersParser._parsePartition(xmlFile, node, server)
else:
raise RuntimeError("Invalid element '%s' in servers file: '%s'" % (node.tag, xmlFile,))
if server.id is None or server.uri is None:
- raise RuntimeError("Invalid partition '%s' in servers file: '%s'" % (child.tag, xmlFile,))
+ raise RuntimeError("Invalid server '%s' in servers file: '%s'" % (child.tag, xmlFile,))
server.check(ignoreIPLookupFailures=ignoreIPLookupFailures)
results[server.id] = server
return results
-
-
- @staticmethod
- def _parsePartition(xmlFile, partitions, server):
-
- for child in partitions:
-
- if child.tag != ELEMENT_PARTITION:
- raise RuntimeError("Unknown partition type: '%s' in servers file: '%s'" % (child.tag, xmlFile,))
-
- id = None
- uri = None
- for node in child:
- if node.tag == ELEMENT_ID:
- id = node.text
- elif node.tag == ELEMENT_URI:
- uri = node.text
- else:
- raise RuntimeError("Invalid element '%s' in augment file: '%s'" % (node.tag, xmlFile,))
-
- if id is None or uri is None:
- raise RuntimeError("Invalid partition '%s' in servers file: '%s'" % (child.tag, xmlFile,))
-
- server.addPartition(id, uri)
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/remoteservers.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -23,7 +23,7 @@
"""
XML based iSchedule configuration file handling. This is for handling of remote servers. The localservers.py module
-handles servers that are local (partitioned or podded).
+handles servers that are local (podded).
"""
__all__ = [
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/scheduler.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/scheduler.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -231,7 +231,7 @@
originatorPrincipal = self.txn.directoryService().recordWithCalendarUserAddress(self.originator)
localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(self.originator))
if originatorPrincipal or localUser:
- if originatorPrincipal.locallyHosted():
+ if originatorPrincipal.thisServer():
log.error("Cannot use originator that is on this server: %s" % (self.originator,))
raise HTTPError(self.errorResponse(
responsecode.FORBIDDEN,
@@ -309,23 +309,17 @@
def _validAlternateServer(self, principal):
"""
- Check the validity of the partitioned host.
+ Check the validity of the podded host.
"""
- # Extract expected host/port. This will be the partitionURI, or if no partitions,
- # the serverURI
- expected_uri = principal.partitionURI()
- if expected_uri is None:
- expected_uri = principal.serverURI()
+ # Extract expected host/port. This will be the serverURI.
+ expected_uri = principal.serverURI()
expected_uri = urlparse.urlparse(expected_uri)
# Get the request IP and map to hostname.
clientip = self.remoteAddr.host
- # Check against this server (or any of its partitions). We need this because an external iTIP message
- # may be addressed to users on different partitions, and the node receiving the iTIP message will need to
- # forward it to the partition nodes, thus the client ip seen by the partitions will in fact be the initial
- # receiving node.
+ # Check against this server.
matched = False
if Servers.getThisServer().checkThisIP(clientip):
matched = True
@@ -377,7 +371,7 @@
if organizer:
organizerPrincipal = self.txn.directoryService().recordWithCalendarUserAddress(organizer)
if organizerPrincipal:
- if organizerPrincipal.locallyHosted():
+ if organizerPrincipal.thisServer():
log.error("Invalid ORGANIZER in calendar data: %s" % (self.calendar,))
raise HTTPError(self.errorResponse(
responsecode.FORBIDDEN,
@@ -385,7 +379,7 @@
"Organizer is not local to server",
))
else:
- # Check that the origin server is the correct partition
+ # Check that the origin server is the correct pod
self.organizer = calendarUserFromPrincipal(organizer, organizerPrincipal)
self._validAlternateServer(self.organizer.principal)
else:
@@ -418,7 +412,7 @@
# Attendee cannot be local.
attendeePrincipal = self.txn.directoryService().recordWithCalendarUserAddress(self.attendee)
if attendeePrincipal:
- if attendeePrincipal.locallyHosted():
+ if attendeePrincipal.thisServer():
log.error("Invalid ATTENDEE in calendar data: %s" % (self.calendar,))
raise HTTPError(self.errorResponse(
responsecode.FORBIDDEN,
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/test/test_localservers.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/test/test_localservers.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/ischedule/test/test_localservers.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -37,16 +37,6 @@
<server>
<id>00002</id>
<uri>https://caldav2.example.com:8843</uri>
- <partitions>
- <partition>
- <id>A</id>
- <uri>https://machine1.example.com:8443</uri>
- </partition>
- <partition>
- <id>B</id>
- <uri>https://machine2.example.com:8443</uri>
- </partition>
- </partitions>
</server>
</servers>
"""
@@ -62,16 +52,6 @@
<server>
<id>00002</id>
<uri>https://caldav2.example.com:8843</uri>
- <partitions>
- <partition>
- <id>A</id>
- <uri>https://machine1.example.com:8443</uri>
- </partition>
- <partition>
- <id>B</id>
- <uri>https://machine2.example.com:8443</uri>
- </partition>
- </partitions>
</server>
</servers>
"""
@@ -103,13 +83,7 @@
self.assertEqual(servers.getServerById("00001").shared_secret, "foobar")
self.assertEqual(servers.getServerById("00002").shared_secret, None)
- self.assertEqual(len(servers.getServerById("00001").partitions), 0)
- self.assertEqual(len(servers.getServerById("00002").partitions), 2)
- self.assertEqual(servers.getServerById("00002").getPartitionURIForId("A"), "https://machine1.example.com:8443")
- self.assertEqual(servers.getServerById("00002").getPartitionURIForId("B"), "https://machine2.example.com:8443")
-
-
def test_this_server(self):
servers = self._setupServers()
@@ -129,14 +103,6 @@
self.assertTrue(servers.getServerById("00002").thisServer)
- def test_check_is_partitioned(self):
-
- servers = self._setupServers()
-
- self.assertFalse(servers.getServerById("00001").isPartitioned())
- self.assertTrue(servers.getServerById("00002").isPartitioned())
-
-
def test_check_this_ip(self):
servers = self._setupServers()
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/scheduler.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/scheduler.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/scheduler.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -38,7 +38,6 @@
from txdav.caldav.datastore.scheduling.cuaddress import LocalCalendarUser
from txdav.caldav.datastore.scheduling.cuaddress import RemoteCalendarUser
from txdav.caldav.datastore.scheduling.cuaddress import EmailCalendarUser
-from txdav.caldav.datastore.scheduling.cuaddress import PartitionedCalendarUser
from txdav.caldav.datastore.scheduling.imip.delivery import ScheduleViaIMip
from txdav.caldav.datastore.scheduling.ischedule.delivery import ScheduleViaISchedule
from txdav.caldav.datastore.scheduling.itip import iTIPRequestStatus
@@ -50,8 +49,8 @@
This module handles the delivery of scheduling messages to organizer and attendees. The basic idea is to first
confirm the integrity of the incoming scheduling message, check authorization. Appropriate L{DeliveryService}s
are then used to deliver the message to attendees or organizer. Delivery responses are processed and returned.
-This takes into account partitioning and podding of users by detecting the appropriate host for a calendar
-user and then dispatching the delivery accordingly.
+This takes into account podding of users by detecting the appropriate host for a calendar user and then
+dispatching the delivery accordingly.
The L{Scheduler} class defines the basic behavior for processing deliveries. Sub-classes are defined for the
different ways a deliver can be triggered.
@@ -434,7 +433,6 @@
# Loop over each recipient and aggregate into lists by service types.
caldav_recipients = []
- partitioned_recipients = []
otherserver_recipients = []
remote_recipients = []
imip_recipients = []
@@ -456,9 +454,6 @@
elif isinstance(recipient, LocalCalendarUser):
caldav_recipients.append(recipient)
- elif isinstance(recipient, PartitionedCalendarUser):
- partitioned_recipients.append(recipient)
-
elif isinstance(recipient, OtherServerCalendarUser):
otherserver_recipients.append(recipient)
@@ -480,10 +475,6 @@
if caldav_recipients:
yield self.generateLocalSchedulingResponses(caldav_recipients, responses, freebusy)
- # Now process partitioned recipients
- if partitioned_recipients:
- yield self.generateRemoteSchedulingResponses(partitioned_recipients, responses, freebusy, getattr(self.txn, 'doing_attendee_refresh', False))
-
# Now process other server recipients
if otherserver_recipients:
yield self.generateRemoteSchedulingResponses(otherserver_recipients, responses, freebusy, getattr(self.txn, 'doing_attendee_refresh', False))
@@ -572,8 +563,8 @@
else:
# Map recipient to their inbox
inbox = None
- if principal.calendarsEnabled() and principal.thisServer():
- if principal.locallyHosted():
+ if principal.calendarsEnabled():
+ if principal.thisServer():
recipient_home = yield self.txn.calendarHomeWithUID(principal.uid, create=True)
if recipient_home:
inbox = (yield recipient_home.calendarWithName("inbox"))
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/utils.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/utils.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/scheduling/utils.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -29,7 +29,7 @@
one of them to avoid scheduling problems.
"""
- if record and record.locallyHosted():
+ if record and record.thisServer():
# Get record's calendar-home
calendar_home = yield txn.calendarHomeWithUID(record.uid)
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/test/util.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/test/util.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/datastore/test/util.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -61,7 +61,6 @@
fullName,
calendarUserAddresses,
cutype="INDIVIDUAL",
- locallyHosted=True,
thisServer=True,
):
@@ -72,7 +71,6 @@
self.displayName = self.fullName if self.fullName else self.shortNames[0]
self.calendarUserAddresses = calendarUserAddresses
self.cutype = cutype
- self._locallyHosted = locallyHosted
self._thisServer = thisServer
@@ -92,10 +90,6 @@
return cua
- def locallyHosted(self):
- return self._locallyHosted
-
-
def thisServer(self):
return self._thisServer
Modified: CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/icalendardirectoryservice.py
===================================================================
--- CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/icalendardirectoryservice.py 2013-11-04 21:54:32 UTC (rev 11889)
+++ CalendarServer/branches/users/cdaboo/reverse-proxy-pods/txdav/caldav/icalendardirectoryservice.py 2013-11-05 20:05:41 UTC (rev 11890)
@@ -60,18 +60,9 @@
@rtype: C{str}
"""
- def locallyHosted(): #@NoSelf
- """
- Indicates whether the record is host on this specific server "pod".
-
- @return: C{True} if locally hosted.
- @rtype: C{bool}
- """
-
def thisServer(): #@NoSelf
"""
- Indicates whether the record is hosted on this server or another "pod"
- that hosts the same directory service.
+ Indicates whether the record is hosted on this server "pod".
@return: C{True} if hosted by this service.
@rtype: C{bool}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/f119ed43/attachment.html>
More information about the calendarserver-changes
mailing list