[CalendarServer-changes] [3525] CalDAVTester/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Dec 12 19:15:45 PST 2008
Revision: 3525
http://trac.macosforge.org/projects/calendarserver/changeset/3525
Author: cdaboo at apple.com
Date: 2008-12-12 19:15:45 -0800 (Fri, 12 Dec 2008)
Log Message:
-----------
Clean-up odsetup to work with ToT CalendarServer.
Modified Paths:
--------------
CalDAVTester/trunk/odsetup.py
Added Paths:
-----------
CalDAVTester/trunk/scripts/server/serverinfo-template.xml
Modified: CalDAVTester/trunk/odsetup.py
===================================================================
--- CalDAVTester/trunk/odsetup.py 2008-12-13 02:42:40 UTC (rev 3524)
+++ CalDAVTester/trunk/odsetup.py 2008-12-13 03:15:45 UTC (rev 3525)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
##
-# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2008 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.
@@ -20,7 +20,6 @@
#
from plistlib import readPlist
-from plistlib import readPlistFromString
from plistlib import writePlist
import commands
import getopt
@@ -32,12 +31,9 @@
diradmin_pswd = "admin"
directory_node = "/LDAPv3/127.0.0.1"
config = "/etc/caldavd/caldavd.plist"
-service_locator = "Bogus"
-old_style = False
-serverinfo_default = "scripts/server/serverinfo.xml"
+serverinfo_default = "scripts/server/serverinfo.xml"
serverinfo_template = "scripts/server/serverinfo-template.xml"
-serverinfo_template_old = "scripts/server/serverinfo-template-old.xml"
base_dir = "../CalendarServer/"
@@ -51,29 +47,25 @@
"resource01":"",
}
-# List of users as a tuple: (<<name>>, <<pswd>>, <<ServicesLocator value>, <<repeat count>>)
+# List of users as a tuple: (<<name>>, <<pswd>>, <<repeat count>>)
adminattrs = {
"dsAttrTypeStandard:RealName": "Test Admin",
"dsAttrTypeStandard:EMailAddress": "testadmin at example.com",
- "dsAttrTypeStandard:ServicesLocator": "Bogus"
}
userattrs = {
"dsAttrTypeStandard:RealName": "User %02d",
"dsAttrTypeStandard:EMailAddress": "user%02d at example.com",
- "dsAttrTypeStandard:ServicesLocator": "Bogus"
}
publicattrs = {
"dsAttrTypeStandard:RealName": "Public %02d",
"dsAttrTypeStandard:EMailAddress": "public%02d at example.com",
- "dsAttrTypeStandard:ServicesLocator": "Bogus"
}
locationattrs = {
"dsAttrTypeStandard:GeneratedUID": "Bogus",
"dsAttrTypeStandard:RealName": "Room %02d",
- "dsAttrTypeStandard:ServicesLocator": "Bogus",
"dsAttrTypeStandard:ResourceType": "1",
"dsAttrTypeStandard:ResourceInfo": """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -95,7 +87,6 @@
resourceattrs = {
"dsAttrTypeStandard:GeneratedUID": "Bogus",
"dsAttrTypeStandard:RealName": "Resource %02d",
- "dsAttrTypeStandard:ServicesLocator": "Bogus",
"dsAttrTypeStandard:ResourceType": "0",
"dsAttrTypeStandard:ResourceInfo": """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -117,7 +108,6 @@
groupattrs = {
"dsAttrTypeStandard:RealName": "Group 01",
"dsAttrTypeStandard:EMailAddress": "group01 at example.com",
- "dsAttrTypeStandard:ServicesLocator": "Bogus"
}
records = (
@@ -138,7 +128,6 @@
-p pswd OpenDirectory Admin user password
-f file caldavd.plist config file used by the server
-c users number of user accounts to create (default: 5)
- --old use old-style directory/principal-URL schema
"""
def readConfig(config):
@@ -193,10 +182,7 @@
def buildServerinfo(hostname, docroot):
# Read in the serverinfo-template.xml file
- if old_style:
- fd = open(serverinfo_template_old, "r")
- else:
- fd = open(serverinfo_template, "r")
+ fd = open(serverinfo_template, "r")
try:
data = fd.read()
finally:
@@ -204,12 +190,11 @@
data = data % {
"hostname" : hostname,
- "docroot" : docroot,
- "testadmin_guid" : guids["testadmin"],
- "user01_guid" : guids["user01"],
- "user02_guid" : guids["user02"],
- "user03_guid" : guids["user03"],
- "resource01_guid": guids["resource01"],
+ "useradminguid" : guids["testadmin"],
+ "userguid1" : guids["user01"],
+ "userguid2" : guids["user02"],
+ "userguid3" : guids["user03"],
+ "resourceguid1" : guids["resource01"],
}
fd = open(serverinfo_default, "w")
@@ -221,7 +206,15 @@
def addLargeCalendars(hostname, docroot):
calendars = ("calendar.10", "calendar.100", "calendar.1000",)
- path = os.path.join(docroot, "calendars/users/user01")
+ guid01 = guids["user01"]
+ path = os.path.join(
+ docroot,
+ "calendars",
+ "__uids__",
+ guid01[0:2],
+ guid01[2:4],
+ guid01,
+ )
cmd = "curl --digest -u user01:user01 'http://%s:8008/calendars/users/user01/'" % (hostname,)
commands.getoutput(cmd)
@@ -256,9 +249,6 @@
def createUser(path, user):
# Do dscl command line operations to create a calendar user
- if old_style and path == "/Places":
- path = "/Resources"
-
# Only create if it does not exist
cmd = "dscl -u %s -P %s %s -list %s/%s" % (diradmin_user, diradmin_pswd, directory_node, path, user[0])
if commands.getstatusoutput(cmd)[0] != 0:
@@ -277,8 +267,6 @@
for key, value in user[2].iteritems():
if key == "dsAttrTypeStandard:GeneratedUID":
value = uuid.uuid4()
- elif key == "dsAttrTypeStandard:ServicesLocator":
- value = service_locator
elif key == "dsAttrTypeStandard:ResourceInfo":
value = value % {"guid":guids["user01"]}
cmd = "dscl -u %s -P %s %s -create %s/%s \"%s\" \"%s\"" % (diradmin_user, diradmin_pswd, directory_node, path, user[0], key, value)
@@ -321,8 +309,6 @@
config = value
elif option == "-c":
number_of_users = int(value)
- elif option == "--old":
- old_style = True
else:
print "Unrecognized option: %s" % (option,)
usage()
@@ -353,10 +339,7 @@
doToAccounts(createUser)
# Patch the caldavd.plist file with the testadmin user's guid-based principal-URL
- if old_style:
- patchConfig(config, "/principals/users/testadmin/")
- else:
- patchConfig(config, "/principals/__uids__/%s/" % (guids["testadmin"],))
+ patchConfig(config, "/principals/__uids__/%s/" % (guids["testadmin"],))
# Create an appropriate serverinfo.xml file from the template
buildServerinfo(hostname, docroot)
Added: CalDAVTester/trunk/scripts/server/serverinfo-template.xml
===================================================================
--- CalDAVTester/trunk/scripts/server/serverinfo-template.xml (rev 0)
+++ CalDAVTester/trunk/scripts/server/serverinfo-template.xml 2008-12-13 03:15:45 UTC (rev 3525)
@@ -0,0 +1,322 @@
+<?xml version="1.0" standalone="no"?>
+
+<!DOCTYPE serverinfo SYSTEM "serverinfo.dtd">
+
+<!--
+ Copyright (c) 2006-2008 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.
+ -->
+
+<serverinfo>
+ <host>%(hostname)s</host>
+ <port>8008</port>
+ <authtype>basic</authtype>
+ <substitutions>
+ <substitution>
+ <key>$host:</key>
+ <value>http://%(hostname)s:8008</value>
+ </substitution>
+
+ <!-- relative path to caldav root-->
+ <substitution>
+ <key>$root:</key>
+ <value>/</value>
+ </substitution>
+
+ <!-- relative path to main principal collection-->
+ <substitution>
+ <key>$principalcollection:</key>
+ <value>$root:principals/</value>
+ </substitution>
+
+ <!-- the core recored type collections-->
+ <substitution>
+ <key>$uidstype:</key>
+ <value>__uids__</value>
+ </substitution>
+ <substitution>
+ <key>$userstype:</key>
+ <value>users</value>
+ </substitution>
+ <substitution>
+ <key>$groupstype:</key>
+ <value>groups</value>
+ </substitution>
+ <substitution>
+ <key>$locationstype:</key>
+ <value>locations</value>
+ </substitution>
+ <substitution>
+ <key>$resourcestype:</key>
+ <value>resources</value>
+ </substitution>
+
+ <!-- relative path to record type principal collections-->
+ <substitution>
+ <key>$principals_uids:</key>
+ <value>$principalcollection:$uidstype:/</value>
+ </substitution>
+ <substitution>
+ <key>$principals_users:</key>
+ <value>$principalcollection:$userstype:/</value>
+ </substitution>
+ <substitution>
+ <key>$principals_groups:</key>
+ <value>$principalcollection:$groupstype:/</value>
+ </substitution>
+ <substitution>
+ <key>$principals_resources:</key>
+ <value>$principalcollection:$resourcestype:/</value>
+ </substitution>
+ <substitution>
+ <key>$principals_locations:</key>
+ <value>$principalcollection:$locationstype:/</value>
+ </substitution>
+
+ <!-- relative path to calendars collection-->
+ <substitution>
+ <key>$calendars:</key>
+ <value>$root:calendars/</value>
+ </substitution>
+
+ <!-- relative path to record type calendar collections-->
+ <substitution>
+ <key>$calendars_uids:</key>
+ <value>$calendars:$uidstype:/</value>
+ </substitution>
+ <substitution>
+ <key>$calendars_users:</key>
+ <value>$calendars:$userstype:/</value>
+ </substitution>
+ <substitution>
+ <key>$calendars_groups:</key>
+ <value>$calendars:$groupstype:/</value>
+ </substitution>
+ <substitution>
+ <key>$calendars_resources:</key>
+ <value>$calendars:$resourcestype:/</value>
+ </substitution>
+ <substitution>
+ <key>$calendars_locations:</key>
+ <value>$calendars:$locationstype:/</value>
+ </substitution>
+
+ <!-- primary calendar name-->
+ <substitution>
+ <key>$calendar:</key>
+ <value>calendar</value>
+ </substitution>
+
+ <!-- inbox name-->
+ <substitution>
+ <key>$inbox:</key>
+ <value>inbox</value>
+ </substitution>
+
+ <!-- outbox name-->
+ <substitution>
+ <key>$outbox:</key>
+ <value>outbox</value>
+ </substitution>
+
+ <!-- dropbox name-->
+ <substitution>
+ <key>$dropbox:</key>
+ <value>dropbox</value>
+ </substitution>
+
+ <!-- freebusy name-->
+ <substitution>
+ <key>$freebusy:</key>
+ <value>freebusy</value>
+ </substitution>
+
+ <!-- server-to-server inbox-->
+ <substitution>
+ <key>$servertoserver:</key>
+ <value>$root:inbox</value>
+ </substitution>
+
+ <!-- timezone service-->
+ <substitution>
+ <key>$timezoneservice:</key>
+ <value>$root:timezones</value>
+ </substitution>
+
+ <!-- user id for admin user -->
+ <substitution>
+ <key>$useradmin:</key>
+ <value>admin</value>
+ </substitution>
+ <!-- guid for admin user -->
+ <substitution>
+ <key>$useradminguid:</key>
+ <value>%(useradminguid)s</value>
+ </substitution>
+ <!-- password for admin user -->
+ <substitution>
+ <key>$pswdadmin:</key>
+ <value>admin</value>
+ </substitution>
+
+ <!-- relative path to admin principal resource-->
+ <substitution>
+ <key>$principal_admin:</key>
+ <value>$principals_users:$useradmin:/</value>
+ </substitution>
+ <substitution>
+ <key>$principaluri_admin:</key>
+ <value>$principals_uids:$useradminguid:/</value>
+ </substitution>
+
+ <!-- user id for proxy user -->
+ <substitution>
+ <key>$userproxy:</key>
+ <value>superuser</value>
+ </substitution>
+ <!-- password for proxy user -->
+ <substitution>
+ <key>$pswdproxy:</key>
+ <value>superuser</value>
+ </substitution>
+
+ <!-- user id -->
+ <substitution repeat="10">
+ <key>$userid%%d:</key>
+ <value>user%%02d</value>
+ </substitution>
+ <!-- user guid -->
+ <substitution repeat="10">
+ <key>$userguid%%d:</key>
+ <value>user%%02d</value>
+ </substitution>
+ <!-- password -->
+ <substitution repeat="10">
+ <key>$pswd%%d:</key>
+ <value>user%%02d</value>
+ </substitution>
+ <!-- relative path to first user principal resource-->
+ <substitution repeat="10">
+ <key>$principal%%d:</key>
+ <value>$principals_users:$userid%%d:/</value>
+ </substitution>
+ <substitution repeat="10">
+ <key>$principaluri%%d:</key>
+ <value>$principals_uids:$userguid%%d:/</value>
+ </substitution>
+ <substitution repeat="10">
+ <key>$principal%%dnoslash:</key>
+ <value>$principals_users:$userid%%d:</value>
+ </substitution>
+ <!-- relative path to first user calendar home-->
+ <substitution repeat="10">
+ <key>$pathprefix%%d:</key>
+ <value>$calendars_uids:$userguid%%d:</value>
+ </substitution>
+ <!-- relative path to first user calendar-->
+ <substitution repeat="10">
+ <key>$calendarpath%%d:</key>
+ <value>$calendars_uids:$userguid%%d:/$calendar:</value>
+ </substitution>
+ <!-- relative path to first user calendar home-->
+ <substitution repeat="10">
+ <key>$calendarpathalt%%d:</key>
+ <value>$calendars_uids:$userid%%d:/$calendar:</value>
+ </substitution>
+ <!-- calendar user address of first user-->
+ <substitution repeat="10">
+ <key>$cuaddr%%d:</key>
+ <value>mailto:$userid%%d:@example.com</value>
+ </substitution>
+ <substitution repeat="10">
+ <key>$cuaddralt%%d:</key>
+ <value>$principaluri%%d:</value>
+ </substitution>
+ <substitution repeat="10">
+ <key>$cuaddraltnoslash%%d:</key>
+ <value>$principals_uids:$userguid%%d:</value>
+ </substitution>
+
+ <!-- Override some of the above definitions for special cases -->
+
+ <!-- calendar user address of second user-->
+ <substitution>
+ <key>$cuaddr2:</key>
+ <value>MAILTO:user02 at example.com</value>
+ </substitution>
+
+ <substitution>
+ <key>$userguid1:</key>
+ <value>%(userguid1)s</value>
+ </substitution>
+ <substitution>
+ <key>$userguid12:</key>
+ <value>%(userguid2)s</value>
+ </substitution>
+ <substitution>
+ <key>$userguid3:</key>
+ <value>%(userguid3)s</value>
+ </substitution>
+
+ <!-- resource id-->
+ <substitution>
+ <key>$resourceid1:</key>
+ <value>resource01</value>
+ </substitution>
+ <!-- resource guid-->
+ <substitution>
+ <key>$resourceguid1:</key>
+ <value>%(resourceguid1)s</value>
+ </substitution>
+ <!-- relative path to first resource calendar home-->
+ <substitution>
+ <key>$rpathprefix1:</key>
+ <value>$calendars_uids:$resourceguid1:</value>
+ </substitution>
+ <!-- relative path to first resource calendar home-->
+ <substitution>
+ <key>$rcalendarpath1:</key>
+ <value>$calendars_uids:$resourceguid1:/$calendar:</value>
+ </substitution>
+ <!-- relative path to first resource principal resource-->
+ <substitution>
+ <key>$rprincipal1:</key>
+ <value>$principals_resources:$resourceid1:/</value>
+ </substitution>
+ <substitution>
+ <key>$rprincipaluri1:</key>
+ <value>$principals_uids:$resourceguid1:/</value>
+ </substitution>
+ <substitution>
+ <key>$rcuaddralt1:</key>
+ <value>$rprincipaluri1:</value>
+ </substitution>
+
+ <!-- relative path to disabled group principal resource-->
+ <substitution>
+ <key>$principaldisabled:</key>
+ <value>$principals_groups:disabledgroup/</value>
+ </substitution>
+ <substitution>
+ <key>$principaluridisabled:</key>
+ <value>$principals_uids:disabledgroup/</value>
+ </substitution>
+ <!-- calendar user address of disabled group-->
+ <substitution>
+ <key>$cuaddrdisabled:</key>
+ <value>$principals_uids:disabledgroup/</value>
+ </substitution>
+
+ </substitutions>
+</serverinfo>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081212/05bc014e/attachment-0001.html>
More information about the calendarserver-changes
mailing list