[CalendarServer-changes] [1756] CalDAVTester/trunk/odsetup.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 3 09:14:52 PDT 2007
Revision: 1756
http://trac.macosforge.org/projects/calendarserver/changeset/1756
Author: cdaboo at apple.com
Date: 2007-08-03 09:14:52 -0700 (Fri, 03 Aug 2007)
Log Message:
-----------
Add an option to use old-style schema. Make sure we have the user01 calendar home provisioned before trying to expand
the large calendars.
Modified Paths:
--------------
CalDAVTester/trunk/odsetup.py
Modified: CalDAVTester/trunk/odsetup.py
===================================================================
--- CalDAVTester/trunk/odsetup.py 2007-08-02 20:57:17 UTC (rev 1755)
+++ CalDAVTester/trunk/odsetup.py 2007-08-03 16:14:52 UTC (rev 1756)
@@ -35,9 +35,11 @@
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_template = "scripts/server/serverinfo-template.xml"
+serverinfo_template_old = "scripts/server/serverinfo-template-old.xml"
base_dir = "../CalendarServer/"
@@ -189,7 +191,10 @@
def buildServerinfo(hostname, docroot):
# Read in the serverinfo-template.xml file
- fd = open(serverinfo_template, "r")
+ if old_style:
+ fd = open(serverinfo_template_old, "r")
+ else:
+ fd = open(serverinfo_template, "r")
try:
data = fd.read()
finally:
@@ -230,13 +235,19 @@
return "%s:%s:calendar" % (guid, vhostguid,)
-def addLargeCalendars(docroot):
+def addLargeCalendars(hostname, docroot):
calendars = ("calendar.10", "calendar.100", "calendar.1000",)
path = os.path.join(docroot, "calendars/users/user01")
+ cmd = "curl --digest -u user01:user01 'http://%s:8008/calendars/users/user01/'" % (hostname,)
+ commands.getoutput(cmd)
+
for calendar in calendars:
cmd = "tar -C %s -zx -f data/%s.tgz" % (path, calendar,)
commands.getoutput(cmd)
+ cpath = os.path.join(path, calendar)
+ cmd = "chown -R calendar:calendar %s" % (cpath,)
+ commands.getoutput(cmd)
def doToAccounts(f):
for record in records:
@@ -255,6 +266,9 @@
def createUser(path, user):
# Do dscl command line operations to create a calendar user
+ if old_style and path == "/Places":
+ path = "/Resources"
+
# Create the user
cmd = "dscl -u %s -P %s %s -create %s/%s" % (diradmin_user, diradmin_pswd, directory_node, path, user[0])
print cmd
@@ -296,7 +310,7 @@
if __name__ == "__main__":
try:
- options, args = getopt.getopt(sys.argv[1:], "n:p:u:f:")
+ options, args = getopt.getopt(sys.argv[1:], "n:p:u:f:", ["old"])
for option, value in options:
if option == "-h":
@@ -310,6 +324,8 @@
diradmin_pswd = value
elif option == "-f":
config = value
+ elif option == "--old":
+ old_style = True
else:
print "Unrecognized option: %s" % (option,)
usage()
@@ -343,13 +359,16 @@
doToAccounts(createUser)
# Patch the caldavd.plist file with the testadmin user's guid-based principal-URL
- patchConfig(config, "/principals/__uids__/%s/" % (guids["testadmin"],))
+ if old_style:
+ patchConfig(config, "/principals/users/testadmin/")
+ else:
+ patchConfig(config, "/principals/__uids__/%s/" % (guids["testadmin"],))
# Create an appropriate serverinfo.xml file from the template
buildServerinfo(hostname, docroot)
# Add large calendars to user account
- addLargeCalendars(docroot)
+ addLargeCalendars(hostname, docroot)
elif args[0] == "remove":
doToAccounts(removeUser)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070803/f4a63114/attachment.html
More information about the calendarserver-changes
mailing list