[Checkins] SVN: zope.mkzeoinst/trunk/ Added an option to spell the host interface to be listened on
Tres Seaver
tseaver at palladion.com
Thu Apr 22 14:24:40 EDT 2010
Log message for revision 111275:
Added an option to spell the host interface to be listened on
- The host is in addition to the port specified for the generated ZEO server
configuration. Thanks to Igor Stroh for the patch. See:
https://bugs.launchpad.net/zodb/+bug/143361
Fixed generated templates to cope with the move of ``zdaemon`` code into
its own project.
Changed:
U zope.mkzeoinst/trunk/CHANGES.txt
U zope.mkzeoinst/trunk/src/zope/mkzeoinst/__init__.py
-=-
Modified: zope.mkzeoinst/trunk/CHANGES.txt
===================================================================
--- zope.mkzeoinst/trunk/CHANGES.txt 2010-04-22 18:18:04 UTC (rev 111274)
+++ zope.mkzeoinst/trunk/CHANGES.txt 2010-04-22 18:24:40 UTC (rev 111275)
@@ -5,5 +5,12 @@
3.9.4 (unreleased)
------------------
+- Added an option to spell the host interface to be listened on, as well as
+ the port the generated ZEO server configuration. Thanks to Igor Stroh
+ for the patch. See: https://bugs.launchpad.net/zodb/+bug/143361
+
+- Fixed generated templates to cope with the move of ``zdaemon`` code into
+ its own project.
+
- Forked from the version of the ``mkzeoinst`` script contained in
ZODB 3.9.4.
Modified: zope.mkzeoinst/trunk/src/zope/mkzeoinst/__init__.py
===================================================================
--- zope.mkzeoinst/trunk/src/zope/mkzeoinst/__init__.py 2010-04-22 18:18:04 UTC (rev 111274)
+++ zope.mkzeoinst/trunk/src/zope/mkzeoinst/__init__.py 2010-04-22 18:24:40 UTC (rev 111275)
@@ -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 checkins
mailing list