[Zodb-checkins] SVN: ZODB/branches/tseaver-lp_143361/ Fix 'ZEO/mkzeoinst.py', broken since 'zdeamon' was split out of the ZODB.

Tres Seaver tseaver at palladion.com
Sat Apr 17 16:11:19 EDT 2010


Log message for revision 111015:
  Fix 'ZEO/mkzeoinst.py', broken since 'zdeamon' was split out of the ZODB.
  
  Also, added support in 'mkzeoinst.py', for supplying a host interface,
  in addition to a port number, when creating a new ZEO server instance.
  
   fixes: lp:143361
  

Changed:
  A   ZODB/branches/tseaver-lp_143361/
  U   ZODB/branches/tseaver-lp_143361/src/CHANGES.txt
  U   ZODB/branches/tseaver-lp_143361/src/ZEO/mkzeoinst.py

-=-
Modified: ZODB/branches/tseaver-lp_143361/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2010-04-14 20:12:35 UTC (rev 110913)
+++ ZODB/branches/tseaver-lp_143361/src/CHANGES.txt	2010-04-17 20:11:19 UTC (rev 111015)
@@ -8,6 +8,10 @@
 New Features
 ------------
 
+- In 'ZEO/mkzeoinst.py', added support for supplying a host interface,
+  in addition to a port number, when creating a new ZEO server instance.
+  (https://bugs.launchpad.net/zodb/+bug/143361)
+
 - Added a '--kill-old-on-full' argument to the backup options:  if passed,
   remove any older full or incremental backup files from the repository after
   doing a full backup. (https://bugs.launchpad.net/zope2/+bug/143158)
@@ -20,6 +24,9 @@
 Bugs Fixed
 ----------
 
+- Fixed 'mkzeoinst', which has generated broken 'zeoctl' scripts since the
+  'zdaemon' package was split out of ZODB for separate distribution.
+
 - Fixed bug in cPickleCache's byte size estimation logic.
   (https://bugs.launchpad.net/zodb/+bug/533015)
 

Modified: ZODB/branches/tseaver-lp_143361/src/ZEO/mkzeoinst.py
===================================================================
--- ZODB/trunk/src/ZEO/mkzeoinst.py	2010-04-14 20:12:35 UTC (rev 110913)
+++ ZODB/branches/tseaver-lp_143361/src/ZEO/mkzeoinst.py	2010-04-17 20:11:19 UTC (rev 111015)
@@ -13,7 +13,7 @@
 ##############################################################################
 """%(program)s -- create a ZEO instance.
 
-Usage: %(program)s home [port]
+Usage: %(program)s home [[host:]port]
 
 Given an "instance home directory" <home> and some configuration
 options (all of which have default values), create the following:
@@ -43,7 +43,7 @@
 %%define INSTANCE %(instance_home)s
 
 <zeo>
-  address %(port)d
+  address %(address)s
   read-only false
   invalidation-queue-size 100
   # pid-filename $INSTANCE/var/ZEO.pid
@@ -73,7 +73,7 @@
   default-to-interactive true
   # user zope
   python %(python)s
-  zdrun %(zodb3_home)s/zdaemon/zdrun.py
+  zdrun %(zdaemon_home)s/zdaemon/zdrun.py
 
   # This logfile should match the one in the %(package)s.conf file.
   # It is used by zdctl's logtail command, zdrun/zdctl doesn't write it.
@@ -143,36 +143,50 @@
             print msg
             sys.exit()
         if len(args) not in [1, 2]:
-            print "Usage: %s home [port]" % program
+            print "Usage: %s home [[host:]port]" % program
             sys.exit(2)
 
         instance_home = args[0]
         if not os.path.isabs(instance_home):
             instance_home = os.path.abspath(instance_home)
 
+        zodb3_home = None
         for entry in sys.path:
             if os.path.exists(os.path.join(entry, 'ZODB')):
                 zodb3_home = entry
                 break
-        else:
+        if zodb3_home is None:
             print "Can't find the Zope home (not in sys.path)"
             sys.exit(2)
 
+        import zdaemon
+        zdaemon_home = os.path.split(zdaemon.__path__[0])[0]
+
+        host = None
+        port = 9999
         if args[1:]:
-            port = int(args[1])
-        else:
-            port = 8100  # match example in zope.conf
+            addr_string = args[1]
+            if ':' in addr_string:
+                host, port = addr_string.split(':', 1)
+            else:
+                port = addr_string
+            port = int(port)
+        address = port
+        if host:
+            address = host + ':' + str(port)
 
-        params = self.get_params(zodb3_home, instance_home, port)
+        params = self.get_params(zodb3_home, zdaemon_home,
+                                 instance_home, address)
         self.create(instance_home, params)
 
-    def get_params(self, zodb3_home, instance_home, port):
+    def get_params(self, zodb3_home, zdaemon_home, instance_home, address):
         return {
             "package": "zeo",
             "PACKAGE": "ZEO",
             "zodb3_home": zodb3_home,
+            "zdaemon_home": zdaemon_home,
             "instance_home": instance_home,
-            "port": port,
+            "address": address,
             "python": sys.executable,
             }
 



More information about the Zodb-checkins mailing list