[CalendarServer-changes] [5085] CalendarServer/branches/users/cdaboo/relative-config-paths-5070
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 10 09:26:18 PST 2010
Revision: 5085
http://trac.macosforge.org/projects/calendarserver/changeset/5085
Author: cdaboo at apple.com
Date: 2010-02-10 09:26:15 -0800 (Wed, 10 Feb 2010)
Log Message:
-----------
Allow for paths relative to a ServerRoot path in the .plist.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tap/test/test_caldav.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/gateway.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/gateway/caldavd.plist
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/test_gateway.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-apple.plist
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-primary.plist
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-secondary.plist
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-test.plist
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd.plist
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/config.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/augment.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxy.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxyloader.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_augment.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_calendar.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_guidchange.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_modify.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_principal.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipaldb.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipalmembers.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_resources.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/xmlfile.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/scheduling/ischeduleservers.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/stdconfig.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_config.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_stdconfig.py
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/util.py
Removed Paths:
-------------
CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/modify/caldavd.plist
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tap/test/test_caldav.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tap/test/test_caldav.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -210,19 +210,20 @@
"type": "twistedcaldav.directory.augment.AugmentXMLDB"
}
- self.config.DocumentRoot = self.mktemp()
- self.config.DataRoot = self.mktemp()
+ self.config.ServerRoot = self.mktemp()
+ self.config.ConfigRoot = "config"
self.config.ProcessType = "Slave"
self.config.SSLPrivateKey = pemFile
self.config.SSLCertificate = pemFile
self.config.SudoersFile = ""
- if self.configOptions:
- _mergeData(self.config, self.configOptions)
+ self.config.update(self.configOptions if self.configOptions else {})
- os.mkdir(self.config.DocumentRoot)
- os.mkdir(self.config.DataRoot)
+ os.mkdir(self.config.ServerRoot)
+ os.mkdir(os.path.join(self.config.ServerRoot, self.config.DocumentRoot))
+ os.mkdir(os.path.join(self.config.ServerRoot, self.config.DataRoot))
+ os.mkdir(os.path.join(self.config.ServerRoot, self.config.ConfigRoot))
self.configFile = self.mktemp()
@@ -689,23 +690,27 @@
Test that a sudo directory service is available if the
SudoersFile is set and exists
"""
- self.config.SudoersFile = self.mktemp()
-
+ self.config.SudoersFile = "sudoers.plist"
+ sudoersFilePath = os.path.join(
+ self.config.ServerRoot,
+ self.config.ConfigRoot,
+ self.config.SudoersFile
+ )
self.writeConfig()
- open(self.config.SudoersFile, "w").write(sudoersFile)
+ open(sudoersFilePath, "w").write(sudoersFile)
site = self.getSite()
principals = site.resource.resource.resource.getChild("principals")
directory = principals.directory
- self.failUnless(self.config.SudoersFile)
+ self.failUnless(sudoersFilePath)
sudoService = directory.serviceForRecordType(SudoDirectoryService.recordType_sudoers)
self.assertEquals(
sudoService.plistFile.path,
- os.path.abspath(self.config.SudoersFile)
+ os.path.abspath(sudoersFilePath)
)
self.failUnless(
SudoDirectoryService.recordType_sudoers
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/gateway.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/gateway.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -28,6 +28,7 @@
from twisted.internet.defer import inlineCallbacks
from twisted.python.util import switchUID
from twistedcaldav.config import config, ConfigurationError
+from twistedcaldav.stdconfig import DEFAULT_CONFIG
from twistedcaldav.directory.directory import DirectoryError
from twisted.web2.dav import davxml
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/gateway/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/gateway/caldavd.plist 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/gateway/caldavd.plist 2010-02-10 17:26:15 UTC (rev 5085)
@@ -73,14 +73,30 @@
Data Store
-->
+ <!-- Server root -->
+ <key>ServerRoot</key>
+ <string>%(ServerRoot)s</string>
+
<!-- Data root -->
<key>DataRoot</key>
- <string>%(DataRoot)s</string>
+ <string>Data</string>
<!-- Document root -->
<key>DocumentRoot</key>
- <string>%(DocumentRoot)s</string>
+ <string>Documents</string>
+ <!-- Configuration root -->
+ <key>ConfigRoot</key>
+ <string>/etc/caldavd</string>
+
+ <!-- Log root -->
+ <key>LogRoot</key>
+ <string>/var/log/caldavd</string>
+
+ <!-- Run root -->
+ <key>RunRoot</key>
+ <string>/var/run</string>
+
<!-- Child aliases -->
<key>Aliases</key>
<dict>
@@ -130,7 +146,7 @@
<key>params</key>
<dict>
<key>xmlFile</key>
- <string>%(DirectoryXMLFile)s</string>
+ <string>accounts.xml</string>
<key>recordTypes</key>
<array>
<string>users</string>
@@ -150,7 +166,7 @@
<key>params</key>
<dict>
<key>xmlFile</key>
- <string>%(ResourceXMLFile)s</string>
+ <string>resources.xml</string>
<key>recordTypes</key>
<array>
<string>resources</string>
@@ -197,7 +213,7 @@
<dict>
<key>xmlFiles</key>
<array>
- <string>%(AugmentXMLFile)s</string>
+ <string>augments.xml</string>
</array>
</dict>
</dict>
@@ -243,7 +259,7 @@
<key>params</key>
<dict>
<key>dbpath</key>
- <string>%(ProxyDBFile)s</string>
+ <string>proxies.sqlite</string>
</dict>
</dict>
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/test_gateway.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/test_gateway.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/calendarserver/tools/test/test_gateway.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -101,54 +101,38 @@
class GatewayTestCase(TestCase):
def setUp(self):
+ super(GatewayTestCase, self).setUp()
+
testRoot = os.path.join(os.path.dirname(__file__), "gateway")
templateName = os.path.join(testRoot, "caldavd.plist")
templateFile = open(templateName)
template = templateFile.read()
templateFile.close()
- tmpDir = FilePath(self.mktemp())
- tmpDir.makedirs()
- dataRoot = tmpDir.child("data")
- dataRoot.makedirs()
- docRoot = tmpDir.child("documents")
- docRoot.makedirs()
+ newConfig = template % {
+ 'ServerRoot' : os.path.abspath(config.ServerRoot),
+ }
+ configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
+ configFilePath.setContent(newConfig)
- # Copy xml files to a temp directory because they may get modified
+ self.configFileName = configFilePath.path
+ config.load(self.configFileName)
origUsersFile = FilePath(os.path.join(os.path.dirname(__file__),
"gateway", "users-groups.xml"))
- copyUsersFile = tmpDir.child("users-groups.xml")
+ copyUsersFile = FilePath(os.path.join(config.DataRoot, "accounts.xml"))
origUsersFile.copyTo(copyUsersFile)
origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
"gateway", "resources-locations.xml"))
- copyResourcesFile = tmpDir.child("resources-locations.xml")
+ copyResourcesFile = FilePath(os.path.join(config.DataRoot, "resources.xml"))
origResourcesFile.copyTo(copyResourcesFile)
origAugmentFile = FilePath(os.path.join(os.path.dirname(__file__),
"gateway", "augments.xml"))
- copyAugmentFile = tmpDir.child("augments.xml")
+ copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
origAugmentFile.copyTo(copyAugmentFile)
- proxyFile = tmpDir.child("proxies.sqlite")
-
- newConfig = template % {
- 'DataRoot' : dataRoot.path,
- 'DocumentRoot' : docRoot.path,
- 'DirectoryXMLFile' : copyUsersFile.path,
- 'ResourceXMLFile' : copyResourcesFile.path,
- 'AugmentXMLFile' : copyAugmentFile.path,
- 'ProxyDBFile' : proxyFile.path,
- }
- configFilePath = tmpDir.child("caldavd.plist")
- configFilePath.setContent(newConfig)
-
- self.configFileName = configFilePath.path
- config.load(self.configFileName)
-
- super(GatewayTestCase, self).setUp()
-
# Make sure trial puts the reactor in the right state, by letting it
# run one reactor iteration. (Ignore me, please.)
d = Deferred()
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-apple.plist 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-apple.plist 2010-02-10 17:26:15 UTC (rev 5085)
@@ -76,14 +76,30 @@
Data Store
-->
+ <!-- Server root -->
+ <key>ServerRoot</key>
+ <string>/Library/CalendarServer</string>
+
<!-- Data root -->
<key>DataRoot</key>
- <string>/Library/CalendarServer/Data/</string>
+ <string>Data</string>
<!-- Document root -->
<key>DocumentRoot</key>
- <string>/Library/CalendarServer/Documents/</string>
+ <string>Documents</string>
+ <!-- Configuration root -->
+ <key>ConfigRoot</key>
+ <string>/etc/caldavd</string>
+
+ <!-- Log root -->
+ <key>LogRoot</key>
+ <string>/var/log/caldavd</string>
+
+ <!-- Run root -->
+ <key>RunRoot</key>
+ <string>/var/run</string>
+
<!-- Child aliases -->
<key>Aliases</key>
<dict>
@@ -134,7 +150,7 @@
<key>params</key>
<dict>
<key>xmlFile</key>
- <string>/etc/caldavd/accounts.xml</string>
+ <string>accounts.xml</string>
</dict>
</dict>
-->
@@ -170,7 +186,7 @@
<key>params</key>
<dict>
<key>xmlFile</key>
- <string>/Library/CalendarServer/Data/resources.xml</string>
+ <string>resources.xml</string>
</dict>
</dict>
@@ -194,7 +210,7 @@
<dict>
<key>xmlFiles</key>
<array>
- <string>/etc/caldavd/augments.xml</string>
+ <string>augments.xml</string>
</array>
</dict>
</dict>
@@ -209,7 +225,7 @@
<key>params</key>
<dict>
<key>dbpath</key>
- <string>/etc/caldavd/augments.sqlite</string>
+ <string>augments.sqlite</string>
</dict>
</dict>
-->
@@ -240,7 +256,7 @@
<key>params</key>
<dict>
<key>dbpath</key>
- <string>/Library/CalendarServer/Data/proxies.sqlite</string>
+ <string>proxies.sqlite</string>
</dict>
</dict>
@@ -282,7 +298,7 @@
<!-- Principals that can pose as other principals -->
<key>SudoersFile</key>
- <string>/etc/caldavd/sudoers.plist</string>
+ <string>sudoers.plist</string>
<!-- Create "proxy access" principals -->
<key>EnableProxyPrincipals</key>
@@ -360,13 +376,13 @@
<!-- Apache-style access log -->
<key>AccessLogFile</key>
- <string>/var/log/caldavd/access.log</string>
+ <string>access.log</string>
<key>RotateAccessLog</key>
<true/>
<!-- Server activity log -->
<key>ErrorLogFile</key>
- <string>/var/log/caldavd/error.log</string>
+ <string>error.log</string>
<!-- Log levels -->
<key>DefaultLogLevel</key>
@@ -374,15 +390,11 @@
<!-- Global server stats -->
<key>GlobalStatsSocket</key>
- <string>/var/run/caldavd-stats.sock</string>
+ <string>caldavd-stats.sock</string>
- <!-- Server statistics file -->
- <key>ServerStatsFile</key>
- <string>/var/run/caldavd/stats.plist</string>
-
<!-- Server process ID file -->
<key>PIDFile</key>
- <string>/var/run/caldavd.pid</string>
+ <string>caldavd.pid</string>
<!--
@@ -490,7 +502,7 @@
<array>
</array>
<key>Servers</key>
- <string>/etc/caldavd/servertoserver.xml</string>
+ <string>servertoserver.xml</string>
</dict>
<!-- iMIP protocol options -->
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-primary.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-primary.plist 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-primary.plist 2010-02-10 17:26:15 UTC (rev 5085)
@@ -28,7 +28,7 @@
<key>ServerPartitionID</key>
<string>00001</string>
<key>PartitionConfigFile</key>
- <string>/etc/caldavd/partitions.plist</string>
+ <string>partitions.plist</string>
<key>MaxClients</key>
<integer>5</integer>
</dict>
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-secondary.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-secondary.plist 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-partitioning-secondary.plist 2010-02-10 17:26:15 UTC (rev 5085)
@@ -28,7 +28,7 @@
<key>ServerPartitionID</key>
<string>00002</string>
<key>PartitionConfigFile</key>
- <string>/etc/caldavd/partitions.plist</string>
+ <string>partitions.plist</string>
<key>MaxClients</key>
<integer>5</integer>
</dict>
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-test.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-test.plist 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd-test.plist 2010-02-10 17:26:15 UTC (rev 5085)
@@ -73,14 +73,30 @@
Data Store
-->
+ <!-- Server root -->
+ <key>ServerRoot</key>
+ <string>data</string>
+
<!-- Data root -->
<key>DataRoot</key>
- <string>data/</string>
+ <string>Data</string>
<!-- Document root -->
<key>DocumentRoot</key>
- <string>twistedcaldav/test/data/</string>
+ <string>Documents</string>
+ <!-- Configuration root -->
+ <key>ConfigRoot</key>
+ <string>./conf</string>
+
+ <!-- Log root -->
+ <key>LogRoot</key>
+ <string>Logs</string>
+
+ <!-- Run root -->
+ <key>RunRoot</key>
+ <string>Tmp</string>
+
<!-- Child aliases -->
<key>Aliases</key>
<dict>
@@ -130,7 +146,7 @@
<key>params</key>
<dict>
<key>xmlFile</key>
- <string>conf/auth/accounts-test.xml</string>
+ <string>./conf/auth/accounts-test.xml</string>
<key>recordTypes</key>
<array>
<string>users</string>
@@ -150,7 +166,7 @@
<key>params</key>
<dict>
<key>xmlFile</key>
- <string>conf/auth/resources-test.xml</string>
+ <string>./conf/auth/resources-test.xml</string>
<key>recordTypes</key>
<array>
<string>locations</string>
@@ -195,7 +211,7 @@
<dict>
<key>xmlFiles</key>
<array>
- <string>conf/auth/augments-test.xml</string>
+ <string>./conf/auth/augments-test.xml</string>
</array>
</dict>
</dict>
@@ -210,7 +226,7 @@
<key>params</key>
<dict>
<key>dbpath</key>
- <string>/etc/caldavd/augments.sqlite</string>
+ <string>./conf/auth/augments.sqlite</string>
</dict>
</dict>
-->
@@ -241,7 +257,7 @@
<key>params</key>
<dict>
<key>dbpath</key>
- <string>data/proxies.sqlite</string>
+ <string>proxies.sqlite</string>
</dict>
</dict>
@@ -263,7 +279,7 @@
-->
<key>ProxyLoadFromFile</key>
- <string>conf/auth/proxies-test.xml</string>
+ <string>./conf/auth/proxies-test.xml</string>
<!--
Special principals
@@ -286,7 +302,7 @@
<!-- Principals that can pose as other principals -->
<key>SudoersFile</key>
- <string>conf/sudoers.plist</string>
+ <string>sudoers.plist</string>
<!-- Create "proxy access" principals -->
<key>EnableProxyPrincipals</key>
@@ -372,13 +388,13 @@
<!-- Apache-style access log -->
<key>AccessLogFile</key>
- <string>logs/access.log</string>
+ <string>access.log</string>
<key>RotateAccessLog</key>
<false/>
<!-- Server activity log -->
<key>ErrorLogFile</key>
- <string>logs/error.log</string>
+ <string>error.log</string>
<!-- Log levels -->
<key>DefaultLogLevel</key>
@@ -395,7 +411,7 @@
<!-- Global server stats -->
<key>GlobalStatsSocket</key>
- <string>logs/caldavd-stats.sock</string>
+ <string>caldavd-stats.sock</string>
<!-- Global server stats logging period -->
<key>GlobalStatsLoggingPeriod</key>
@@ -405,13 +421,9 @@
<key>GlobalStatsLoggingFrequency</key>
<integer>12</integer>
- <!-- Server statistics file -->
- <key>ServerStatsFile</key>
- <string>logs/stats.plist</string>
-
<!-- Server process ID file -->
<key>PIDFile</key>
- <string>logs/caldavd.pid</string>
+ <string>caldavd.pid</string>
<!--
@@ -585,7 +597,7 @@
<array>
</array>
<key>Servers</key>
- <string>conf/servertoserver-test.xml</string>
+ <string>servertoserver-test.xml</string>
</dict>
<!-- iMIP protocol options -->
@@ -704,7 +716,7 @@
<!-- A unix socket used for communication between the child and master processes.
An empty value tells the server to use a tcp socket instead. -->
<key>ControlSocket</key>
- <string>logs/caldavd.sock</string>
+ <string>caldavd.sock</string>
<!-- Support for Memcached -->
<key>Memcached</key>
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd.plist 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/conf/caldavd.plist 2010-02-10 17:26:15 UTC (rev 5085)
@@ -76,14 +76,30 @@
Data Store
-->
+ <!-- Server root -->
+ <key>ServerRoot</key>
+ <string>/Library/CalendarServer</string>
+
<!-- Data root -->
<key>DataRoot</key>
- <string>/Library/CalendarServer/Data/</string>
+ <string>Data</string>
<!-- Document root -->
<key>DocumentRoot</key>
- <string>/Library/CalendarServer/Documents/</string>
+ <string>Documents</string>
+ <!-- Configuration root -->
+ <key>ConfigRoot</key>
+ <string>/etc/caldavd</string>
+
+ <!-- Log root -->
+ <key>LogRoot</key>
+ <string>/var/log/caldavd</string>
+
+ <!-- Run root -->
+ <key>RunRoot</key>
+ <string>/var/run</string>
+
<!-- Child aliases -->
<key>Aliases</key>
<dict>
@@ -133,7 +149,7 @@
<key>params</key>
<dict>
<key>xmlFile</key>
- <string>/etc/caldavd/accounts.xml</string>
+ <string>accounts.xml</string>
</dict>
</dict>
@@ -173,7 +189,7 @@
<dict>
<key>xmlFiles</key>
<array>
- <string>/etc/caldavd/augments.xml</string>
+ <string>augments.xml</string>
</array>
</dict>
</dict>
@@ -219,7 +235,7 @@
<key>params</key>
<dict>
<key>dbpath</key>
- <string>/etc/caldavd/proxies.sqlite</string>
+ <string>proxies.sqlite</string>
</dict>
</dict>
@@ -261,7 +277,7 @@
<!-- Principals that can pose as other principals -->
<key>SudoersFile</key>
- <string>/etc/caldavd/sudoers.plist</string>
+ <string>sudoers.plist</string>
<!-- Create "proxy access" principals -->
<key>EnableProxyPrincipals</key>
@@ -332,13 +348,13 @@
<!-- Apache-style access log -->
<key>AccessLogFile</key>
- <string>/var/log/caldavd/access.log</string>
+ <string>access.log</string>
<key>RotateAccessLog</key>
<true/>
<!-- Server activity log -->
<key>ErrorLogFile</key>
- <string>/var/log/caldavd/error.log</string>
+ <string>error.log</string>
<!-- Log levels -->
<key>DefaultLogLevel</key>
@@ -346,15 +362,11 @@
<!-- Global server stats -->
<key>GlobalStatsSocket</key>
- <string>/var/run/caldavd-stats.sock</string>
+ <string>caldavd-stats.sock</string>
- <!-- Server statistics file -->
- <key>ServerStatsFile</key>
- <string>/var/run/caldavd/stats.plist</string>
-
<!-- Server process ID file -->
<key>PIDFile</key>
- <string>/var/run/caldavd.pid</string>
+ <string>caldavd.pid</string>
<!--
@@ -462,7 +474,7 @@
<array>
</array>
<key>Servers</key>
- <string>/etc/caldavd/servertoserver.xml</string>
+ <string>servertoserver.xml</string>
</dict>
<!-- iMIP protocol options -->
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/config.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/config.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2010 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.
@@ -119,8 +119,8 @@
self._provider = ConfigProvider()
else:
self._provider = provider
- self._preUpdateHooks = set()
- self._postUpdateHooks = set()
+ self._preUpdateHooks = list()
+ self._postUpdateHooks = list()
self.reset()
def __setattr__(self, attr, value):
@@ -159,15 +159,15 @@
def addPreUpdateHook(self, hook):
if isinstance(hook, list) or isinstance(hook, tuple):
- self._preUpdateHooks.update(hook)
+ self._preUpdateHooks.extend(hook)
else:
- self._preUpdateHooks.add(hook)
+ self._preUpdateHooks.append(hook)
def addPostUpdateHook(self, hook):
if isinstance(hook, list) or isinstance(hook, tuple):
- self._postUpdateHooks.update(hook)
+ self._postUpdateHooks.extend(hook)
else:
- self._postUpdateHooks.add(hook)
+ self._postUpdateHooks.append(hook)
def getProvider(self):
return self._provider
@@ -216,7 +216,6 @@
def reset(self):
self._data = ConfigDict(copy.deepcopy(self._provider.getDefaults()))
-
def _mergeData(oldData, newData):
for key, value in newData.iteritems():
if isinstance(value, (dict,)):
@@ -229,4 +228,10 @@
else:
oldData[key] = value
+def fullServerPath(base, path):
+ if type(path) is str:
+ return os.path.join(base, path) if path and path[0] not in ('/', '.',) else path
+ else:
+ return path
+
config = Config()
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/augment.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/augment.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -24,6 +24,7 @@
from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
ADBAPIPostgreSQLMixin
from twistedcaldav.directory.xmlaugmentsparser import XMLAugmentsParser
+from twistedcaldav.config import fullServerPath, config
log = Logger()
@@ -113,7 +114,7 @@
def __init__(self, xmlFiles, cacheTimeout=30):
- self.xmlFiles = xmlFiles
+ self.xmlFiles = [fullServerPath(config.DataRoot, path) for path in xmlFiles]
self.cacheTimeout = cacheTimeout * 60 # Value is mins we want secs
self.lastCached = 0
self.db = {}
@@ -341,7 +342,7 @@
def __init__(self, dbpath):
ADBAPISqliteMixin.__init__(self)
- AugmentADAPI.__init__(self, "Augments", "sqlite3", (dbpath,))
+ AugmentADAPI.__init__(self, "Augments", "sqlite3", (fullServerPath(config.DataRoot, dbpath),))
class AugmentPostgreSQLDB(ADBAPIPostgreSQLMixin, AugmentADAPI):
"""
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxy.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxy.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -39,7 +39,7 @@
from twext.log import LoggingMixIn
-from twistedcaldav.config import config
+from twistedcaldav.config import config, fullServerPath
from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
ADBAPIPostgreSQLMixin
from twistedcaldav.extensions import DAVFile, DAVPrincipalResource
@@ -785,7 +785,7 @@
def __init__(self, dbpath):
ADBAPISqliteMixin.__init__(self)
- ProxyDB.__init__(self, "Proxies", "sqlite3", (dbpath,))
+ ProxyDB.__init__(self, "Proxies", "sqlite3", (fullServerPath(config.DataRoot, dbpath),))
class ProxyPostgreSQLDB(ADBAPIPostgreSQLMixin, ProxyDB):
"""
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxyloader.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxyloader.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/calendaruserproxyloader.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -30,6 +30,7 @@
from twext.log import Logger
+from twistedcaldav.config import config, fullServerPath
from twistedcaldav.directory import calendaruserproxy
log = Logger()
@@ -54,7 +55,7 @@
def __init__(self, xmlFile):
self.items = []
- self.xmlFile = xmlFile
+ self.xmlFile = fullServerPath(config.DataRoot, xmlFile)
# Read in XML
try:
Deleted: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/modify/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/modify/caldavd.plist 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/modify/caldavd.plist 2010-02-10 17:26:15 UTC (rev 5085)
@@ -1,748 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright (c) 2006-2010 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>
-
- <!--
- Public network address information
-
- This is the server's public network address, which is provided to
- clients in URLs and the like. It may or may not be the network
- address that the server is listening to directly, though it is by
- default. For example, it may be the address of a load balancer or
- proxy which forwards connections to the server.
- -->
-
- <!-- Network host name [empty = system host name] -->
- <key>ServerHostName</key>
- <string></string> <!-- The hostname clients use when connecting -->
-
- <!-- HTTP port [0 = disable HTTP] -->
- <key>HTTPPort</key>
- <integer>8008</integer>
-
- <!-- SSL port [0 = disable HTTPS] -->
- <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
- <key>SSLPort</key>
- <integer>8443</integer>
-
- <!-- Redirect non-SSL ports to an SSL port -->
- <key>RedirectHTTPToHTTPS</key>
- <false/>
-
- <!--
- Network address configuration information
-
- This configures the actual network address that the server binds to.
- -->
-
- <!-- List of IP addresses to bind to [empty = all] -->
- <key>BindAddresses</key>
- <array>
- </array>
-
- <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
- <key>BindHTTPPorts</key>
- <array>
- </array>
-
- <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
- <key>BindSSLPorts</key>
- <array>
- </array>
-
-
- <!--
- Data Store
- -->
-
- <!-- Data root -->
- <key>DataRoot</key>
- <string>data/</string>
-
- <!-- Document root -->
- <key>DocumentRoot</key>
- <string>twistedcaldav/test/data/</string>
-
- <!-- Child aliases -->
- <key>Aliases</key>
- <dict>
- <!--
- <key>foo</key>
- <dict>
- <key>path</key>
- <string>/path/to/foo</string>
- </dict>
- -->
- </dict>
-
- <!-- User quota (in bytes) -->
- <key>UserQuota</key>
- <integer>104857600</integer><!-- 100Mb -->
-
- <!-- Attachment size limit (in bytes) -->
- <key>MaximumAttachmentSize</key>
- <integer>1048576</integer><!-- 1Mb -->
-
- <!-- Maximum number of unique attendees per entire event -->
- <!-- 0 for no limit -->
- <key>MaxAttendeesPerInstance</key>
- <integer>100</integer>
-
- <!-- Maximum number of instances allowed for a single RRULE -->
- <!-- 0 for no limit -->
- <key>MaxInstancesForRRULE</key>
- <integer>400</integer>
-
-
- <!--
- Directory service
-
- A directory service provides information about principals (eg.
- users, groups, locations and resources) to the server.
-
- A variety of directory services are available for use.
- -->
-
- <!-- XML File Directory Service -->
- <key>DirectoryService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-
- <key>params</key>
- <dict>
- <key>xmlFile</key>
- <string>SET IN TEST</string>
- <key>recordTypes</key>
- <array>
- <string>users</string>
- <string>groups</string>
- </array>
- </dict>
- </dict>
-
- <!-- XML File Resource Service -->
- <key>ResourceService</key>
- <dict>
- <key>Enabled</key>
- <true/>
- <key>type</key>
- <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-
- <key>params</key>
- <dict>
- <key>xmlFile</key>
- <string>SET IN TEST</string>
- <key>recordTypes</key>
- <array>
- <string>resources</string>
- <string>locations</string>
- </array>
- </dict>
- </dict>
-
- <!-- Open Directory Service (Mac OS X) -->
- <!--
- <key>DirectoryService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-
- <key>params</key>
- <dict>
- <key>node</key>
- <string>/Search</string>
- <key>cacheTimeout</key>
- <integer>30</integer>
- </dict>
- </dict>
- -->
-
- <!--
- Augment service
-
- Augments for the directory service records to add calendar specific attributes.
-
- 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 -->
- <key>AugmentService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
-
- <key>params</key>
- <dict>
- <key>xmlFiles</key>
- <array>
- <string>SET IN TEST</string>
- </array>
- </dict>
- </dict>
-
- <!-- Sqlite Augment Service -->
- <!--
- <key>AugmentService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-
- <key>params</key>
- <dict>
- <key>dbpath</key>
- <string>/etc/caldavd/augments.sqlite</string>
- </dict>
- </dict>
- -->
-
- <!-- PostgreSQL Augment Service -->
- <!--
- <key>AugmentService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-
- <key>params</key>
- <dict>
- <key>host</key>
- <string>localhost</string>
- <key>database</key>
- <string>augments</string>
- </dict>
- </dict>
- -->
-
- <!-- Sqlite ProxyDB Service -->
- <key>ProxyDBService</key>
- <dict>
- <key>type</key>
- <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-
- <key>params</key>
- <dict>
- <key>dbpath</key>
- <string>data/proxies.sqlite</string>
- </dict>
- </dict>
-
- <!-- 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>
- -->
-
- <key>ProxyLoadFromFile</key>
- <string>conf/auth/proxies-test.xml</string>
-
- <!--
- Special principals
-
- These principals are granted special access and/or perform
- special roles on the server.
- -->
-
- <!-- Principals with "DAV:all" access (relative URLs) -->
- <key>AdminPrincipals</key>
- <array>
- <string>/principals/__uids__/admin/</string>
- </array>
-
- <!-- Principals with "DAV:read" access (relative URLs) -->
- <key>ReadPrincipals</key>
- <array>
- <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
- </array>
-
- <!-- Principals that can pose as other principals -->
- <key>SudoersFile</key>
- <string>conf/sudoers.plist</string>
-
- <!-- Create "proxy access" principals -->
- <key>EnableProxyPrincipals</key>
- <true/>
-
-
- <!--
- Permissions
- -->
-
- <!-- Anonymous read access for root resource -->
- <key>EnableAnonymousReadRoot</key>
- <true/>
-
- <!-- Anonymous read access for resource hierarchy -->
- <key>EnableAnonymousReadNav</key>
- <false/>
-
- <!-- Enables directory listings for principals -->
- <key>EnablePrincipalListings</key>
- <true/>
-
- <!-- Render calendar collections as a monolithic iCalendar object -->
- <key>EnableMonolithicCalendars</key>
- <true/>
-
-
- <!--
- Authentication
- -->
-
- <key>Authentication</key>
- <dict>
-
- <!-- Clear text; best avoided -->
- <key>Basic</key>
- <dict>
- <key>Enabled</key>
- <true/>
- </dict>
-
- <!-- Digest challenge/response -->
- <key>Digest</key>
- <dict>
- <key>Enabled</key>
- <true/>
- <key>Algorithm</key>
- <string>md5</string>
- <key>Qop</key>
- <string></string>
- </dict>
-
- <!-- Kerberos/SPNEGO -->
- <key>Kerberos</key>
- <dict>
- <key>Enabled</key>
- <false/>
- <key>ServicePrincipal</key>
- <string></string>
- </dict>
-
- <!-- Wikiserver authentication (Mac OS X) -->
- <key>Wiki</key>
- <dict>
- <key>Enabled</key>
- <true/>
- <key>Cookie</key>
- <string>sessionID</string>
- <key>URL</key>
- <string>http://127.0.0.1/RPC2</string>
- <key>UserMethod</key>
- <string>userForSession</string>
- <key>WikiMethod</key>
- <string>accessLevelForUserWikiCalendar</string>
- </dict>
-
- </dict>
-
-
- <!--
- Logging
- -->
-
- <!-- Apache-style access log -->
- <key>AccessLogFile</key>
- <string>logs/access.log</string>
- <key>RotateAccessLog</key>
- <false/>
-
- <!-- Server activity log -->
- <key>ErrorLogFile</key>
- <string>logs/error.log</string>
-
- <!-- Log levels -->
- <key>DefaultLogLevel</key>
- <string>info</string> <!-- debug, info, warn, error -->
-
- <!-- Log level overrides for specific functionality -->
- <key>LogLevels</key>
- <dict>
- <!--
- <key>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</key>
- <string>debug</string>
- -->
- </dict>
-
- <!-- Global server stats -->
- <key>GlobalStatsSocket</key>
- <string>logs/caldavd-stats.sock</string>
-
- <!-- Global server stats logging period -->
- <key>GlobalStatsLoggingPeriod</key>
- <integer>60</integer>
-
- <!-- Global server stats logging frequency [0 = disable stats] -->
- <key>GlobalStatsLoggingFrequency</key>
- <integer>12</integer>
-
- <!-- Server statistics file -->
- <key>ServerStatsFile</key>
- <string>logs/stats.plist</string>
-
- <!-- Server process ID file -->
- <key>PIDFile</key>
- <string>logs/caldavd.pid</string>
-
-
- <!--
- Accounting
- -->
-
- <!-- Enable accounting for certain operations -->
- <key>AccountingCategories</key>
- <dict>
- <key>iTIP</key>
- <false/>
- <key>HTTP</key>
- <false/>
- </dict>
- <!-- Enable accounting for specific principals -->
- <key>AccountingPrincipals</key>
- <array>
- <!-- <string>/principals/__uids__/454D85C0-09F0-4DC6-A3C6-97DFEB4622CD/</string> -->
- </array>
-
-
- <!--
- SSL/TLS
- -->
-
- <!-- Public key -->
- <key>SSLCertificate</key>
- <string>twistedcaldav/test/data/server.pem</string>
-
- <!-- SSL authority chain (for intermediate certs) -->
- <key>SSLAuthorityChain</key>
- <string></string>
-
- <!-- Private key -->
- <key>SSLPrivateKey</key>
- <string>twistedcaldav/test/data/server.pem</string>
-
-
- <!--
- Process management
- -->
-
- <key>UserName</key>
- <string></string>
-
- <key>GroupName</key>
- <string></string>
-
- <key>ProcessType</key>
- <string>Combined</string>
-
- <key>MultiProcess</key>
- <dict>
- <key>ProcessCount</key>
- <integer>2</integer> <!-- 0 = larger of: 4 or (2 * CPU count) -->
- </dict>
-
-
- <!--
- Notifications
- -->
-
- <key>Notifications</key>
- <dict>
- <!-- Time spent coalescing notifications before delivery -->
- <key>CoalesceSeconds</key>
- <integer>3</integer>
-
- <key>InternalNotificationHost</key>
- <string>localhost</string>
-
- <key>InternalNotificationPort</key>
- <integer>62309</integer>
-
- <key>Services</key>
- <dict>
- <key>SimpleLineNotifier</key>
- <dict>
- <!-- Simple line notification service (for testing) -->
- <key>Service</key>
- <string>twistedcaldav.notify.SimpleLineNotifierService</string>
- <key>Enabled</key>
- <false/>
- <key>Port</key>
- <integer>62308</integer>
- </dict>
-
- <key>XMPPNotifier</key>
- <dict>
- <!-- XMPP notification service -->
- <key>Service</key>
- <string>twistedcaldav.notify.XMPPNotifierService</string>
- <key>Enabled</key>
- <false/>
-
- <!-- XMPP host and port to contact -->
- <key>Host</key>
- <string>xmpp.host.name</string>
- <key>Port</key>
- <integer>5222</integer>
-
- <!-- Jabber ID and password for the server -->
- <key>JID</key>
- <string>jid at xmpp.host.name/resource</string>
- <key>Password</key>
- <string>password_goes_here</string>
-
- <!-- PubSub service address -->
- <key>ServiceAddress</key>
- <string>pubsub.xmpp.host.name</string>
-
- <key>NodeConfiguration</key>
- <dict>
- <key>pubsub#deliver_payloads</key>
- <string>1</string>
- <key>pubsub#persist_items</key>
- <string>1</string>
- </dict>
-
- <!-- Sends a presence notification to XMPP server at this interval (prevents disconnect) -->
- <key>KeepAliveSeconds</key>
- <integer>120</integer>
-
- <!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
- <key>HeartbeatMinutes</key>
- <integer>30</integer>
-
- <!-- List of glob-like expressions defining which XMPP JIDs can converse with the server (for debugging) -->
- <key>AllowedJIDs</key>
- <array>
- <!--
- <string>*.example.com</string>
- -->
- </array>
- </dict>
- </dict>
- </dict>
-
-
- <!--
- Server-to-server protocol
- -->
-
- <key>Scheduling</key>
- <dict>
-
- <!-- CalDAV protocol options -->
- <key>CalDAV</key>
- <dict>
- <key>EmailDomain</key>
- <string></string>
- <key>HTTPDomain</key>
- <string></string>
- <key>AddressPatterns</key>
- <array>
- </array>
- <key>OldDraftCompatibility</key>
- <true/>
- <key>ScheduleTagCompatibility</key>
- <true/>
- <key>EnablePrivateComments</key>
- <true/>
- </dict>
-
- <!-- iSchedule protocol options -->
- <key>iSchedule</key>
- <dict>
- <key>Enabled</key>
- <false/>
- <key>AddressPatterns</key>
- <array>
- </array>
- <key>Servers</key>
- <string>conf/servertoserver-test.xml</string>
- </dict>
-
- <!-- iMIP protocol options -->
- <key>iMIP</key>
- <dict>
- <key>Enabled</key>
- <false/>
- <key>MailGatewayServer</key>
- <string>localhost</string>
- <key>MailGatewayPort</key>
- <integer>62310</integer>
- <key>Sending</key>
- <dict>
- <key>Server</key>
- <string></string>
- <key>Port</key>
- <integer>587</integer>
- <key>UseSSL</key>
- <true/>
- <key>Username</key>
- <string></string>
- <key>Password</key>
- <string></string>
- <key>Address</key>
- <string></string> <!-- Address email will be sent from -->
- </dict>
- <key>Receiving</key>
- <dict>
- <key>Server</key>
- <string></string>
- <key>Port</key>
- <integer>995</integer>
- <key>Type</key>
- <string></string> <!-- Either "pop" or "imap" -->
- <key>UseSSL</key>
- <true/>
- <key>Username</key>
- <string></string>
- <key>Password</key>
- <string></string>
- <key>PollingSeconds</key>
- <integer>30</integer>
- </dict>
- <key>AddressPatterns</key>
- <array>
- <string>mailto:.*</string>
- </array>
- </dict>
-
- <!-- General options for scheduling -->
- <key>Options</key>
- <dict>
- <key>AllowGroupAsOrganizer</key>
- <false/>
- <key>AllowLocationAsOrganizer</key>
- <false/>
- <key>AllowResourceAsOrganizer</key>
- <false/>
- </dict>
-
- </dict>
-
-
- <!--
- Free-busy URL protocol
- -->
-
- <key>FreeBusyURL</key>
- <dict>
- <key>Enabled</key>
- <true/>
- <key>TimePeriod</key>
- <integer>14</integer>
- <key>AnonymousAccess</key>
- <false/>
- </dict>
-
-
- <!--
- Non-standard CalDAV extensions
- -->
-
- <!-- Calendar Drop Box -->
- <key>EnableDropBox</key>
- <true/>
-
- <!-- Private Events -->
- <key>EnablePrivateEvents</key>
- <true/>
-
- <!-- Timezone Service -->
- <key>EnableTimezoneService</key>
- <true/>
-
-
- <!--
- Miscellaneous items
- -->
-
- <!-- Service ACLs (Mac OS X) -->
- <key>EnableSACLs</key>
- <false/>
-
- <!-- Web-based administration -->
- <key>EnableWebAdmin</key>
- <true/>
-
- <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
- <key>ResponseCompression</key>
- <false/>
-
- <!-- The retry-after value (in seconds) to return with a 503 error. -->
- <key>HTTPRetryAfter</key>
- <integer>180</integer>
-
- <!-- A unix socket used for communication between the child and master processes.
- An empty value tells the server to use a tcp socket instead. -->
- <key>ControlSocket</key>
- <string>logs/caldavd.sock</string>
-
- <!-- Support for Memcached -->
- <key>Memcached</key>
- <dict>
- <key>MaxClients</key>
- <integer>5</integer>
- <key>memcached</key>
- <string>memcached</string> <!-- Find in PATH -->
- <key>Options</key>
- <array>
- <!--<string>-vv</string>-->
- </array>
- </dict>
-
- <!-- Response Caching -->
- <key>ResponseCacheTimeout</key>
- <integer>30</integer> <!-- in minutes -->
-
-
- <!--
- Twisted
- -->
-
- <key>Twisted</key>
- <dict>
- <key>twistd</key>
- <string>../Twisted/bin/twistd</string>
- </dict>
-
-
- <key>Localization</key>
- <dict>
- <key>LocalesDirectory</key>
- <string>locales</string>
- <key>Language</key>
- <string>English</string>
- </dict>
-
-
- </dict>
-</plist>
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_augment.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_augment.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_augment.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -110,7 +110,7 @@
@inlineCallbacks
def test_read(self):
- db = AugmentSqliteDB(self.mktemp())
+ db = AugmentSqliteDB(os.path.abspath(self.mktemp()))
dbxml = AugmentXMLDB((xmlFile,))
for record in dbxml.db.values():
@@ -124,7 +124,7 @@
@inlineCallbacks
def test_read_default(self):
- db = AugmentSqliteDB(self.mktemp())
+ db = AugmentSqliteDB(os.path.abspath(self.mktemp()))
dbxml = AugmentXMLDB((xmlFileDefault,))
for record in dbxml.db.values():
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_calendar.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_calendar.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_calendar.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -28,6 +28,7 @@
from twistedcaldav.static import CalendarHomeProvisioningFile
import twistedcaldav.test.util
+from twistedcaldav.config import config
class ProvisionedCalendars (twistedcaldav.test.util.TestCase):
"""
@@ -37,11 +38,11 @@
super(ProvisionedCalendars, self).setUp()
# Setup the initial directory
- self.xmlFile = self.mktemp()
+ self.xmlFile = os.path.join(config.DataRoot, "accounts.xml")
fd = open(self.xmlFile, "w")
fd.write(open(xmlFile.path, "r").read())
fd.close()
- self.directoryService = XMLDirectoryService({'xmlFile' : self.xmlFile})
+ self.directoryService = XMLDirectoryService({'xmlFile' : "accounts.xml"})
augment.AugmentService = augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
# Set up a principals hierarchy for each service we're testing with
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_guidchange.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_guidchange.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_guidchange.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -38,7 +38,7 @@
super(ProvisionedPrincipals, self).setUp()
# Setup the initial directory
- self.xmlFile = self.mktemp()
+ self.xmlFile = os.path.abspath(self.mktemp())
fd = open(self.xmlFile, "w")
fd.write(open(xmlFile.path, "r").read())
fd.close()
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_modify.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_modify.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_modify.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -25,14 +25,16 @@
class ModificationTestCase(TestCase):
def setUp(self):
+ super(ModificationTestCase, self).setUp()
+
testRoot = os.path.join(os.path.dirname(__file__), "modify")
- configFileName = os.path.join(testRoot, "caldavd.plist")
- config.load(configFileName)
+ #configFileName = os.path.join(testRoot, "caldavd.plist")
+ #config.load(configFileName)
usersFile = os.path.join(testRoot, "users-groups.xml")
config.DirectoryService.params.xmlFile = usersFile
- # Copy xml file containgin locations/resources to a temp file because
+ # Copy xml file containing locations/resources to a temp file because
# we're going to be modifying it during testing
origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
@@ -40,12 +42,11 @@
copyResourcesFile = FilePath(self.mktemp())
origResourcesFile.copyTo(copyResourcesFile)
config.ResourceService.params.xmlFile = copyResourcesFile
+ config.ResourceService.Enabled = True
augmentsFile = os.path.join(testRoot, "augments.xml")
config.AugmentService.params.xmlFiles = (augmentsFile,)
- super(ModificationTestCase, self).setUp()
-
def test_createRecord(self):
directory = getDirectory()
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_principal.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_principal.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_principal.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -67,7 +67,7 @@
self.principalRootResources[directory.__class__.__name__] = provisioningResource
augment.AugmentService = augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
- calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB(self.mktemp())
+ calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB(os.path.abspath(self.mktemp()))
def test_hierarchy(self):
"""
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipaldb.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipaldb.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipaldb.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -13,15 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
##
-from twistedcaldav.config import config
from twisted.internet.defer import inlineCallbacks
+from twistedcaldav.config import config
+from twistedcaldav.directory import calendaruserproxy
from twistedcaldav.directory.calendaruserproxy import ProxySqliteDB,\
ProxyPostgreSQLDB
+from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
import twistedcaldav.test.util
-from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
-from twistedcaldav.directory import calendaruserproxy
+import os
+
class ProxyPrincipalDBSqlite (twistedcaldav.test.util.TestCase):
"""
Directory service provisioned principals.
@@ -73,7 +75,7 @@
def test_normalDB(self):
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = ProxySqliteDB(db_path)
yield db.setGroupMembers("A", ("B", "C", "D",))
@@ -87,7 +89,7 @@
def test_DBIndexed(self):
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = ProxySqliteDB(db_path)
self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set(("GROUPNAMES", "MEMBERS")))
@@ -95,7 +97,7 @@
def test_OldDB(self):
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = self.old_ProxyDB(db_path)
self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set())
@@ -103,7 +105,7 @@
def test_DBUpgrade(self):
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = self.old_ProxyDB(db_path)
yield db.setGroupMembers("A", ("B", "C", "D",))
@@ -131,7 +133,7 @@
def test_DBUpgradeNewer(self):
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = self.old_ProxyDB(db_path)
yield db.setGroupMembers("A", ("B", "C", "D",))
@@ -159,7 +161,7 @@
def test_DBNoUpgradeNewer(self):
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = self.new_ProxyDB(db_path)
yield db.setGroupMembers("A", ("B", "C", "D",))
@@ -190,7 +192,7 @@
config.ProcessType = processType
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = ProxySqliteDB(db_path)
# Do one insert and check the result
@@ -230,7 +232,7 @@
config.ProcessType = processType
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = ProxySqliteDB(db_path)
# Do one insert and check the result
@@ -271,7 +273,7 @@
config.ProcessType = processType
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = ProxySqliteDB(db_path)
# Do one insert and check the result
@@ -304,7 +306,7 @@
config.ProcessType = processType
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = ProxySqliteDB(db_path)
# Do one insert and check the result
@@ -345,7 +347,7 @@
config.ProcessType = processType
# Get the DB
- db_path = self.mktemp()
+ db_path = os.path.abspath(self.mktemp())
db = ProxySqliteDB(db_path)
# Do one insert and check the result for the one we will remove
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipalmembers.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipalmembers.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_proxyprincipalmembers.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -43,7 +43,7 @@
self.directoryService = XMLDirectoryService({'xmlFile' : xmlFile})
augment.AugmentService = augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
- calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB(self.mktemp())
+ calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB("proxies.sqlite")
# Set up a principals hierarchy for each service we're testing with
self.principalRootResources = {}
@@ -56,8 +56,6 @@
self.principalRootResources[self.directoryService.__class__.__name__] = provisioningResource
- config.DataRoot = self.mktemp()
- os.mkdir(config.DataRoot)
yield XMLCalendarUserProxyLoader(proxiesFile.path).updateProxyDB()
def _getPrincipalByShortName(self, type, name):
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_resources.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_resources.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/test/test_resources.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -22,21 +22,20 @@
class ResourcesTestCase(TestCase):
def setUp(self):
- testRoot = os.path.join(os.path.dirname(__file__), "resources")
- configFileName = os.path.join(testRoot, "caldavd.plist")
- config.load(configFileName)
+ super(ResourcesTestCase, self).setUp()
+ testRoot = os.path.join(".", os.path.dirname(__file__), "resources")
+
xmlFile = os.path.join(testRoot, "users-groups.xml")
config.DirectoryService.params.xmlFile = xmlFile
xmlFile = os.path.join(testRoot, "resources-locations.xml")
config.ResourceService.params.xmlFile = xmlFile
+ config.ResourceService.Enabled = True
xmlFile = os.path.join(testRoot, "augments.xml")
config.AugmentService.params.xmlFiles = (xmlFile,)
- super(ResourcesTestCase, self).setUp()
-
# Uh, what's this testing?
# def test_loadConfig(self):
# directory = getDirectory()
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/xmlfile.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/xmlfile.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/directory/xmlfile.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -31,6 +31,7 @@
from twisted.python.filepath import FilePath
from twistedcaldav.config import config
+from twistedcaldav.config import fullServerPath
from twistedcaldav.directory import augment
from twistedcaldav.directory.directory import DirectoryService, DirectoryError
from twistedcaldav.directory.cachingdirectory import CachingDirectoryService,\
@@ -72,7 +73,7 @@
super(XMLDirectoryService, self).__init__(params['cacheTimeout'])
- xmlFile = params.get("xmlFile")
+ xmlFile = fullServerPath(config.DataRoot, params.get("xmlFile"))
if type(xmlFile) is str:
xmlFile = FilePath(xmlFile)
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/scheduling/ischeduleservers.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/scheduling/ischeduleservers.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/scheduling/ischeduleservers.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -18,7 +18,7 @@
from twext.log import Logger
-from twistedcaldav.config import config
+from twistedcaldav.config import config, fullServerPath
from twistedcaldav.scheduling.delivery import DeliveryService
import xml.dom.minidom
@@ -46,7 +46,12 @@
def _loadConfig(self):
if IScheduleServers._servers is None:
- IScheduleServers._xmlFile = FilePath(config.Scheduling[DeliveryService.serviceType_ischedule]["Servers"])
+ IScheduleServers._xmlFile = FilePath(
+ fullServerPath(
+ config.ConfigRoot,
+ config.Scheduling[DeliveryService.serviceType_ischedule]["Servers"]
+ )
+ )
IScheduleServers._xmlFile.restat()
fileInfo = (IScheduleServers._xmlFile.getmtime(), IScheduleServers._xmlFile.getsize())
if fileInfo != IScheduleServers._fileInfo:
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/stdconfig.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/stdconfig.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -27,7 +27,7 @@
from twext.log import clearLogLevels, setLogLevelForNamespace
from twistedcaldav.config import ConfigProvider, ConfigurationError
-from twistedcaldav.config import config, _mergeData
+from twistedcaldav.config import config, _mergeData, fullServerPath
from twistedcaldav.partitions import partitions
from twistedcaldav.util import getPasswordFromKeychain
from twistedcaldav.util import KeychainAccessError, KeychainPasswordNotFound
@@ -38,7 +38,7 @@
DEFAULT_SERVICE_PARAMS = {
"twistedcaldav.directory.xmlfile.XMLDirectoryService": {
- "xmlFile": "/etc/caldavd/accounts.xml",
+ "xmlFile": "accounts.xml",
"cacheTimeout": 30,
"recordTypes": ("users", "groups"),
},
@@ -51,7 +51,7 @@
DEFAULT_RESOURCE_PARAMS = {
"twistedcaldav.directory.xmlfile.XMLDirectoryService": {
- "xmlFile": "/etc/caldavd/resources.xml",
+ "xmlFile": "resources.xml",
"cacheTimeout": 30,
"realmName": "/Search",
"recordTypes" : ("locations", "resources"),
@@ -60,10 +60,10 @@
DEFAULT_AUGMENT_PARAMS = {
"twistedcaldav.directory.augment.AugmentXMLDB": {
- "xmlFiles": ["/etc/caldavd/augments.xml",],
+ "xmlFiles": ["augments.xml",],
},
"twistedcaldav.directory.augment.AugmentSqliteDB": {
- "dbpath": "/etc/caldavd/augments.sqlite",
+ "dbpath": "augments.sqlite",
},
"twistedcaldav.directory.augment.AugmentPostgreSQLDB": {
"host": "localhost",
@@ -75,7 +75,7 @@
DEFAULT_PROXYDB_PARAMS = {
"twistedcaldav.directory.calendaruserproxy.ProxySqliteDB": {
- "dbpath": "/etc/caldavd/proxies.sqlite",
+ "dbpath": "proxies.sqlite",
},
"twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB": {
"host": "localhost",
@@ -117,8 +117,12 @@
#
# Data store
#
- "DataRoot" : "/Library/CalendarServer/Data",
- "DocumentRoot" : "/Library/CalendarServer/Documents",
+ "ServerRoot" : "/Library/CalendarServer",
+ "DataRoot" : "Data",
+ "DocumentRoot" : "Documents",
+ "ConfigRoot" : "/etc/caldavd",
+ "LogRoot" : "/var/log/caldavd",
+ "RunRoot" : "/var/run",
"UserQuota" : 104857600, # User quota (in bytes)
"MaximumAttachmentSize" : 1048576, # Attachment size limit (in bytes)
"MaxAttendeesPerInstance" : 100, # Maximum number of unique attendees
@@ -174,7 +178,7 @@
#
"AdminPrincipals": [], # Principals with "DAV:all" access (relative URLs)
"ReadPrincipals": [], # Principals with "DAV:read" access (relative URLs)
- "SudoersFile": "/etc/caldavd/sudoers.plist", # Principals that can pose as other principals
+ "SudoersFile": "sudoers.plist", # Principals that can pose as other principals
"EnableProxyPrincipals": True, # Create "proxy access" principals
#
@@ -216,10 +220,9 @@
#
# Logging
#
- "AccessLogFile" : "/var/log/caldavd/access.log", # Apache-style access log
- "ErrorLogFile" : "/var/log/caldavd/error.log", # Server activity log
- "ServerStatsFile": "/var/run/caldavd/stats.plist",
- "PIDFile" : "/var/run/caldavd.pid",
+ "AccessLogFile" : "access.log", # Apache-style access log
+ "ErrorLogFile" : "error.log", # Server activity log
+ "PIDFile" : "caldavd.pid",
"RotateAccessLog" : False,
"EnableExtendedAccessLog": True,
"DefaultLogLevel" : "",
@@ -230,9 +233,9 @@
"iTIP": False,
},
"AccountingPrincipals": [],
- "AccountingLogRoot" : "/var/log/caldavd/accounting",
+ "AccountingLogRoot" : "accounting",
- "GlobalStatsSocket" : "/var/run/caldavd-stats.sock",
+ "GlobalStatsSocket" : "caldavd-stats.sock",
"GlobalStatsLoggingPeriod" : 60,
"GlobalStatsLoggingFrequency" : 12,
@@ -304,7 +307,7 @@
"iSchedule": {
"Enabled" : False, # iSchedule protocol
"AddressPatterns" : [], # Reg-ex patterns to match iSchedule-able calendar user addresses
- "Servers" : "/etc/caldavd/servertoserver.xml", # iSchedule server configurations
+ "Servers" : "servertoserver.xml", # iSchedule server configurations
},
"iMIP": {
@@ -390,7 +393,7 @@
"Partitioning" : {
"Enabled": False, # Partitioning enabled or not
"ServerPartitionID": "", # Unique ID for this server's partition instance.
- "PartitionConfigFile": "/etc/caldavd/partitions.plist", # File path for partition information
+ "PartitionConfigFile": "partitions.plist", # File path for partition information
"MaxClients": 5, # Pool size for connections to each partition
},
@@ -439,7 +442,7 @@
# A unix socket used for communication between the child and master
# processes. If blank, then an AF_INET socket is used instead.
- "ControlSocket": "/var/run/caldavd.sock",
+ "ControlSocket": "caldavd.sock",
# Support for Content-Encoding compression options as specified in
@@ -516,13 +519,15 @@
# 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:
- additionalDict = self._parseConfigFromFile(include)
+ additionalDict = self._parseConfigFromFile(fullServerPath(configRoot, include))
if additionalDict:
log.info("Adding configuration from file: '%s'" % (include,))
configDict.update(additionalDict)
+ _updateDataStore(configDict)
return configDict
def _parseConfigFromFile(self, filename):
@@ -538,6 +543,36 @@
return configDict
+def _updateDataStore(configDict):
+
+ # Base paths
+ if hasattr(configDict, "ServerRoot"):
+ configDict.DataRoot = fullServerPath(configDict.ServerRoot, configDict.DataRoot)
+ configDict.DocumentRoot = fullServerPath(configDict.ServerRoot, configDict.DocumentRoot)
+ configDict.ConfigRoot = fullServerPath(configDict.ServerRoot, configDict.ConfigRoot)
+ configDict.LogRoot = fullServerPath(configDict.ServerRoot, configDict.LogRoot)
+ configDict.RunRoot = fullServerPath(configDict.ServerRoot, configDict.RunRoot)
+
+ # Config paths
+ if hasattr(configDict, "SudoersFile"):
+ configDict.SudoersFile = fullServerPath(configDict.ConfigRoot, configDict.SudoersFile)
+
+ # Log paths
+ if hasattr(configDict, "AccessLogFile"):
+ configDict.AccessLogFile = fullServerPath(configDict.LogRoot, configDict.AccessLogFile)
+ if hasattr(configDict, "ErrorLogFile"):
+ configDict.ErrorLogFile = fullServerPath(configDict.LogRoot, configDict.ErrorLogFile)
+ if hasattr(configDict, "AccountingLogRoot"):
+ configDict.AccountingLogRoot = fullServerPath(configDict.LogRoot, configDict.AccountingLogRoot)
+
+ # Run paths
+ if hasattr(configDict, "PIDFile"):
+ configDict.PIDFile = fullServerPath(configDict.RunRoot, configDict.PIDFile)
+ if hasattr(configDict, "GlobalStatsSocket"):
+ configDict.GlobalStatsSocket = fullServerPath(configDict.RunRoot, configDict.GlobalStatsSocket)
+ if hasattr(configDict, "ControlSocket"):
+ configDict.ControlSocket = fullServerPath(configDict.RunRoot, configDict.ControlSocket)
+
def _updateHostName(configDict):
if not configDict.ServerHostName:
from socket import getfqdn
@@ -784,7 +819,7 @@
if configDict.Partitioning.Enabled:
partitions.setSelfPartition(configDict.Partitioning.ServerPartitionID)
partitions.setMaxClients(configDict.Partitioning.MaxClients)
- partitions.readConfig(configDict.Partitioning.PartitionConfigFile)
+ partitions.readConfig(fullServerPath(configDict.ConfigRoot, configDict.Partitioning.PartitionConfigFile))
partitions.installReverseProxies()
else:
partitions.clear()
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_config.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_config.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -134,25 +134,25 @@
def testDirectoryService_noChange(self):
self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
- self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+ self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
config.update({"DirectoryService": {}})
self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
- self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+ self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
def testDirectoryService_sameType(self):
self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
- self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+ self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
config.update({"DirectoryService": {"type": "twistedcaldav.directory.xmlfile.XMLDirectoryService"}})
self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
- self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+ self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
def testDirectoryService_newType(self):
self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
- self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+ self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
config.update({"DirectoryService": {"type": "twistedcaldav.directory.appleopendirectory.OpenDirectoryService"}})
@@ -162,7 +162,7 @@
def testDirectoryService_newParam(self):
self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
- self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+ self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
config.update({"DirectoryService": {"type": "twistedcaldav.directory.appleopendirectory.OpenDirectoryService"}})
@@ -171,7 +171,7 @@
def testDirectoryService_unknownType(self):
self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
- self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+ self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
config.update({"DirectoryService": {"type": "twistedcaldav.test.test_config.SuperDuperAwesomeService"}})
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_stdconfig.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_stdconfig.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/test_stdconfig.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -71,10 +71,18 @@
plist1 = """
<plist version="1.0">
<dict>
+ <key>ServerRoot</key>
+ <string>/root</string>
<key>DocumentRoot</key>
<string>defaultdoc</string>
<key>DataRoot</key>
<string>defaultdata</string>
+ <key>ConfigRoot</key>
+ <string>defaultconfig</string>
+ <key>LogRoot</key>
+ <string>defaultlog</string>
+ <key>RunRoot</key>
+ <string>defaultrun</string>
<key>Includes</key>
<array>
<string>%s</string>
@@ -99,10 +107,14 @@
tempfile1.setContent(plist1 % (tempfile2.path,))
cfg = Config(PListConfigProvider({
+ "ServerRoot": "",
"DocumentRoot": "",
"DataRoot": "",
+ "ConfigRoot": "",
+ "LogRoot": "",
+ "RunRoot": "",
"Includes": [],
}))
cfg.load(tempfile1.path)
- self.assertEquals(cfg.DocumentRoot, "defaultdoc")
- self.assertEquals(cfg.DataRoot, "overridedata")
+ self.assertEquals(cfg.DocumentRoot, "/root/defaultdoc")
+ self.assertEquals(cfg.DataRoot, "/root/overridedata")
Modified: CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/util.py
===================================================================
--- CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/util.py 2010-02-09 21:57:13 UTC (rev 5084)
+++ CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twistedcaldav/test/util.py 2010-02-10 17:26:15 UTC (rev 5085)
@@ -25,6 +25,7 @@
from twistedcaldav import memcacher
from twistedcaldav.config import config
+from twistedcaldav.stdconfig import _updateDataStore
from twistedcaldav.static import CalDAVFile
import memcacheclient
@@ -39,9 +40,20 @@
def setUp(self):
super(TestCase, self).setUp()
- dataroot = self.mktemp()
- os.mkdir(dataroot)
- config.DataRoot = dataroot
+ config.reset()
+ serverroot = self.mktemp()
+ os.mkdir(serverroot)
+ config.ServerRoot = serverroot
+ config.ConfigRoot = "config"
+ _updateDataStore(config)
+
+ if not os.path.exists(config.DataRoot):
+ os.makedirs(config.DataRoot)
+ if not os.path.exists(config.DocumentRoot):
+ os.makedirs(config.DocumentRoot)
+ if not os.path.exists(config.ConfigRoot):
+ os.makedirs(config.ConfigRoot)
+
config.Memcached.Pools.Default.ClientEnabled = False
config.Memcached.Pools.Default.ServerEnabled = False
memcacheclient.ClientFactory.allowTestCache = True
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100210/f11a227b/attachment-0001.html>
More information about the calendarserver-changes
mailing list