summaryrefslogtreecommitdiff
path: root/cpp/config/upgradeicegrid.py
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-06-30 14:55:22 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-06-30 14:55:22 +0000
commit449da665ba62b0d228c7f45c7f89f2538560d58e (patch)
tree62ae8abf00564500ac035dd2ac3d06d92f07cdbb /cpp/config/upgradeicegrid.py
parentFix improperly configure plugin (diff)
downloadice-449da665ba62b0d228c7f45c7f89f2538560d58e.tar.bz2
ice-449da665ba62b0d228c7f45c7f89f2538560d58e.tar.xz
ice-449da665ba62b0d228c7f45c7f89f2538560d58e.zip
Added upgradeicegrid.py script
Diffstat (limited to 'cpp/config/upgradeicegrid.py')
-rwxr-xr-xcpp/config/upgradeicegrid.py117
1 files changed, 117 insertions, 0 deletions
diff --git a/cpp/config/upgradeicegrid.py b/cpp/config/upgradeicegrid.py
new file mode 100755
index 00000000000..0def1e2ef8a
--- /dev/null
+++ b/cpp/config/upgradeicegrid.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# This script upgrades the IceGrid registry database environment for
+# 3.0.x version of IceGrid to the new format in 3.1.
+#
+# Usage:
+#
+# python upgradeicegrid.py ice30_home ice31_home olddbenv newdbenv
+#
+# Where:
+#
+# ice30_home is the path of the Ice 3.0.x distribution.
+# ice31_home is the path of the Ice 3.1 distribution.
+# olddbenv is the path of the Ice 3.0.x registry database environment
+# newdbenv is the path of the Ice 3.1 registry database environment
+#
+
+import sys, os
+
+ice30_home = None
+ice31_home = None
+olddbenv = None
+newdbenv = None
+
+#
+# Show usage information.
+#
+def usage():
+ print "Usage: " + sys.argv[0] + " ice30_home ice31_home olddbenv newdbenv"
+ print
+ print "Options:"
+ print "-h Show this message."
+
+def printOutputFromPipe(pipe):
+ while 1:
+ line = pipe.readline()
+ if not line:
+ break
+ os.write(1, line)
+
+def transformdb(dbname, desc):
+ global ice30_home, ice31_home, olddbenv, newdbenv
+
+ transformdb = os.path.join(ice31_home, "bin", "transformdb") + \
+ " --include-old " + os.path.join(ice30_home, "slice") + \
+ " --include-new " + os.path.join(ice31_home, "slice") + \
+ " --old " + os.path.join(ice30_home, "slice", "IceGrid", "Admin.ice") + \
+ " --new " + os.path.join(ice31_home, "slice", "IceGrid", "Admin.ice")
+
+ tmpdesc = os.path.join(newdbenv, "tmpdesc" + dbname + ".xml")
+ tmpfile = open(tmpdesc, "w+")
+ tmpfile.write(desc)
+ tmpfile.close()
+
+ pipe = os.popen(transformdb + " -f " + tmpdesc + " " + olddbenv + " " + dbname + " " + newdbenv)
+ printOutputFromPipe(pipe)
+ os.remove(tmpdesc)
+ if pipe.close():
+ sys.exit(1)
+
+
+#
+# Check arguments
+#
+for x in sys.argv[1:]:
+ if x == "-h":
+ usage()
+ sys.exit(0)
+ elif x.startswith("-"):
+ print sys.argv[0] + ": unknown option `" + x + "'"
+ print
+ usage()
+ sys.exit(1)
+
+if len(sys.argv) < 5:
+ usage()
+ sys.exit(0)
+
+ice30_home = sys.argv[1]
+ice31_home = sys.argv[2]
+olddbenv = sys.argv[3]
+newdbenv = sys.argv[4]
+
+transformdb("applications", \
+'<transformdb>' + \
+' <database key="string" value="::IceGrid::ApplicationDescriptor">' + \
+' <record/>' + \
+' </database>' + \
+' <transform type="::IceGrid::CommunicatorDescriptor">' + \
+' <set target="new.propertySet.properties" value="old.properties"/>' + \
+' </transform>' + \
+'</transformdb>')
+
+transformdb("adapters", \
+'<transformdb>' + \
+' <database key="string" value="::IceGrid::AdapterInfo">' + \
+' <record>' + \
+' <set target="newvalue.id" value="oldkey"/>' + \
+' </record>' + \
+' </database>' + \
+'</transformdb>')
+
+transformdb("objects", \
+'<transformdb>' + \
+' <database key="::Ice::Identity" value="::IceGrid::ObjectInfo">' + \
+' <record/>' + \
+' </database>' + \
+'</transformdb>')