summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-08 10:34:20 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-08 10:34:20 +0000
commit2cb4a47d99dcd55db0db3fd11d63d3c9e6a2962a (patch)
tree14d8ccaff9441834ee49cfe02566d8766d9c9e36
parent5e7fdbb97435fd823290c4040f01d1fe8481b9f7 (diff)
downloadpykolab-2cb4a47d99dcd55db0db3fd11d63d3c9e6a2962a.tar.gz
Allow -b/--bind and -p/--port options to be specified on the command-line, for greater flexibility.
Move the standard port to 10027.
-rw-r--r--wallace/__init__.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/wallace/__init__.py b/wallace/__init__.py
index b9df940..5897ac7 100644
--- a/wallace/__init__.py
+++ b/wallace/__init__.py
@@ -44,6 +44,22 @@ class WallaceDaemon(object):
help = _("Fork to the background.")
)
+ daemon_group.add_option(
+ "-b", "--bind",
+ dest = "wallace_bind_address",
+ action = "store",
+ default = "localhost",
+ help = _("Bind address for Wallace.")
+ )
+
+ daemon_group.add_option(
+ "-p", "--port",
+ dest = "wallace_port",
+ action = "store",
+ default = 10027,
+ help = _("Port that Wallace is supposed to use.")
+ )
+
conf.finalize_conf()
import modules
@@ -228,10 +244,17 @@ class WallaceDaemon(object):
bound = False
while not bound:
try:
- s.bind(('localhost', 8025))
+ s.bind((conf.wallace_bind_address, conf.wallace_port))
bound = True
except Exception, e:
- log.warning(_("Could not bind to socket on port 8025"))
+ log.warning(
+ _("Could not bind to socket on port %d on bind " + \
+ "address %s") %(
+ conf.wallace_port,
+ conf.wallace_bind_address
+ )
+ )
+
try:
s.shutdown(1)
except Exception, e: