[CalendarServer-changes] [3689] CalendarServer/branches/users/sagen/migration-3686/calendarserver/ tools/migrate.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Feb 19 12:45:31 PST 2009
Revision: 3689
http://trac.macosforge.org/projects/calendarserver/changeset/3689
Author: sagen at apple.com
Date: 2009-02-19 12:45:31 -0800 (Thu, 19 Feb 2009)
Log Message:
-----------
Migration command line tool
Added Paths:
-----------
CalendarServer/branches/users/sagen/migration-3686/calendarserver/tools/migrate.py
Added: CalendarServer/branches/users/sagen/migration-3686/calendarserver/tools/migrate.py
===================================================================
--- CalendarServer/branches/users/sagen/migration-3686/calendarserver/tools/migrate.py (rev 0)
+++ CalendarServer/branches/users/sagen/migration-3686/calendarserver/tools/migrate.py 2009-02-19 20:45:31 UTC (rev 3689)
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+
+##
+# Copyright (c) 2006-2009 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.
+##
+
+"""
+This tool migrates existing calendar data from any previous calendar server
+version to the current version.
+
+This tool requires access to the calendar server's configuration and
+data storage; it does not operate by talking to the server via the
+network.
+"""
+
+import os
+import sys
+from getopt import getopt, GetoptError
+from os.path import dirname, abspath
+
+from twistedcaldav.upgrade import UpgradeTheServer
+from calendarserver.tools.util import loadConfig
+
+def usage(e=None):
+ if e:
+ print e
+ print ""
+
+ name = os.path.basename(sys.argv[0])
+ print "usage: %s [options]" % (name,)
+ print ""
+ print "Migrate calendar data to current version"
+ print __doc__
+ print "options:"
+ print " -h --help: print this help and exit"
+ print " -f --config: Specify caldavd.plist configuration path"
+
+ if e:
+ sys.exit(64)
+ else:
+ sys.exit(0)
+
+def main():
+ try:
+ (optargs, args) = getopt(
+ sys.argv[1:], "hf:", [
+ "config=",
+ "help",
+ ],
+ )
+ except GetoptError, e:
+ usage(e)
+
+ configFileName = None
+
+
+ for opt, arg in optargs:
+ if opt in ("-h", "--help"):
+ usage()
+
+ elif opt in ("-f", "--config"):
+ configFileName = arg
+
+ if args:
+ usage("Too many arguments: %s" % (" ".join(args),))
+
+ config = loadConfig(configFileName)
+ UpgradeTheServer.doUpgrade(config)
+
+if __name__ == "__main__":
+ main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090219/bbc663af/attachment.html>
More information about the calendarserver-changes
mailing list