[CalendarServer-changes] [4985] CalendarServer
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 29 12:17:01 PST 2010
Revision: 4985
http://trac.macosforge.org/projects/calendarserver/changeset/4985
Author: cdaboo at apple.com
Date: 2010-01-29 12:17:01 -0800 (Fri, 29 Jan 2010)
Log Message:
-----------
Allow a list of GUIDs to be managed all in one go.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/deployment-partition-4722/calendarserver/tools/manageaugments.py
CalendarServer/trunk/calendarserver/tools/manageaugments.py
Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/calendarserver/tools/manageaugments.py
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/calendarserver/tools/manageaugments.py 2010-01-29 18:52:31 UTC (rev 4984)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/calendarserver/tools/manageaugments.py 2010-01-29 20:17:01 UTC (rev 4985)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
##
-# Copyright (c) 2009 Apple Inc. All rights reserved.
+# Copyright (c) 2009-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.
@@ -20,6 +20,7 @@
from xml.etree.ElementTree import ElementTree, tostring, SubElement
from xml.parsers.expat import ExpatError
import sys
+import os
def error(s):
print s
@@ -173,6 +174,8 @@
help="XML augment file to manipulate", metavar="FILE")
parser.add_option("-g", "--guid", dest="guid",
help="OD GUID to manipulate", metavar="GUID")
+ parser.add_option("-h", "--guidfile", dest="guidfile",
+ help="File containing a list of GUIDs to manipulate", metavar="GUIDFILE")
parser.add_option("-n", "--node", dest="node",
help="Partition node to assign to GUID", metavar="NODE")
parser.add_option("-c", "--enable-calendar", action="store_true", dest="enable_calendar",
@@ -185,14 +188,27 @@
if len(args) != 1:
parser.error("incorrect number of arguments")
+ guids = []
+ if options.guid:
+ guids.append(options.guid)
+ elif options.guidfile:
+ if not os.path.exists(options.guidfile):
+ parser.error("File containing list of GUIDs does not exist")
+ with open(options.guidfile) as f:
+ for line in f:
+ guids.append(line[:-1])
+
if args[0] == "add":
if not options.node:
- parser.error("Partition node must be specified when adding")
- doAdd(options.xmlfilename, options.guid, options.node, options.enable_calendar, options.auto_schedule)
+ parser.error("Partition node must be specified when adding")
+ for guid in guids:
+ doAdd(options.xmlfilename, guid, options.node, options.enable_calendar, options.auto_schedule)
elif args[0] == "modify":
- doModify(options.xmlfilename, options.guid, options.node, options.enable_calendar, options.auto_schedule)
+ for guid in guids:
+ doModify(options.xmlfilename, guid, options.node, options.enable_calendar, options.auto_schedule)
elif args[0] == "remove":
- doRemove(options.xmlfilename, options.guid)
+ for guid in guids:
+ doRemove(options.xmlfilename, guid)
elif args[0] == "print":
doPrint(options.xmlfilename)
Modified: CalendarServer/trunk/calendarserver/tools/manageaugments.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/manageaugments.py 2010-01-29 18:52:31 UTC (rev 4984)
+++ CalendarServer/trunk/calendarserver/tools/manageaugments.py 2010-01-29 20:17:01 UTC (rev 4985)
@@ -20,6 +20,7 @@
from xml.etree.ElementTree import ElementTree, tostring, SubElement
from xml.parsers.expat import ExpatError
import sys
+import os
def error(s):
print s
@@ -173,6 +174,8 @@
help="XML augment file to manipulate", metavar="FILE")
parser.add_option("-g", "--guid", dest="guid",
help="OD GUID to manipulate", metavar="GUID")
+ parser.add_option("-h", "--guidfile", dest="guidfile",
+ help="File containing a list of GUIDs to manipulate", metavar="GUIDFILE")
parser.add_option("-n", "--node", dest="node",
help="Partition node to assign to GUID", metavar="NODE")
parser.add_option("-c", "--enable-calendar", action="store_true", dest="enable_calendar",
@@ -185,14 +188,27 @@
if len(args) != 1:
parser.error("incorrect number of arguments")
+ guids = []
+ if options.guid:
+ guids.append(options.guid)
+ elif options.guidfile:
+ if not os.path.exists(options.guidfile):
+ parser.error("File containing list of GUIDs does not exist")
+ with open(options.guidfile) as f:
+ for line in f:
+ guids.append(line[:-1])
+
if args[0] == "add":
if not options.node:
- parser.error("Partition node must be specified when adding")
- doAdd(options.xmlfilename, options.guid, options.node, options.enable_calendar, options.auto_schedule)
+ parser.error("Partition node must be specified when adding")
+ for guid in guids:
+ doAdd(options.xmlfilename, guid, options.node, options.enable_calendar, options.auto_schedule)
elif args[0] == "modify":
- doModify(options.xmlfilename, options.guid, options.node, options.enable_calendar, options.auto_schedule)
+ for guid in guids:
+ doModify(options.xmlfilename, guid, options.node, options.enable_calendar, options.auto_schedule)
elif args[0] == "remove":
- doRemove(options.xmlfilename, options.guid)
+ for guid in guids:
+ doRemove(options.xmlfilename, guid)
elif args[0] == "print":
doPrint(options.xmlfilename)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100129/d0936589/attachment.html>
More information about the calendarserver-changes
mailing list