Commit c712cf81 authored by Michael Graff's avatar Michael Graff

closer to goodness: undoing default port numbers set in __init__() methods and elsewhere

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1554 e5f2f494-b856-4b98-b285-d166d9295462
parent 62243f64
......@@ -118,7 +118,6 @@ class ProcessInfo:
spawn_env['PYTHON_EXEC'] = os.environ['PYTHON_EXEC']
if 'PYTHONPATH' in os.environ:
spawn_env['PYTHONPATH'] = os.environ['PYTHONPATH']
spawn_env['ISC_MSGQ_PORT'] = self.c_channel_port
self.process = subprocess.Popen(self.args,
stdin=subprocess.PIPE,
stdout=spawn_stdout,
......@@ -216,7 +215,7 @@ class BoB:
sys.stdout.write("Starting msgq using port %d\n" %
self.c_channel_port)
try:
c_channel = ProcessInfo("msgq", "msgq", c_channel_env, True)
c_channel = ProcessInfo("msgq", ["msgq"], c_channel_env, True)
except Exception as e:
return "Unable to start msgq; " + str(e)
self.processes[c_channel.pid] = c_channel
......@@ -241,7 +240,8 @@ class BoB:
if self.verbose:
sys.stdout.write("Starting b10-cfgmgr\n")
try:
bind_cfgd = ProcessInfo("b10-cfgmgr", "b10-cfgmgr")
bind_cfgd = ProcessInfo("b10-cfgmgr", ["b10-cfgmgr"],
{ 'ISC_MSGQ_PORT': str(self.c_channel_port)})
except Exception as e:
c_channel.process.kill()
return "Unable to start b10-cfgmgr; " + str(e)
......@@ -269,7 +269,8 @@ class BoB:
self.auth_port)
authargs += ['-v']
try:
auth = ProcessInfo("b10-auth", authargs)
auth = ProcessInfo("b10-auth", authargs,
{ 'ISC_MSGQ_PORT': str(self.c_channel_port)})
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
......@@ -282,7 +283,8 @@ class BoB:
if self.verbose:
sys.stdout.write("Starting b10-xfrin\n")
try:
xfrind = ProcessInfo("b10-xfrin", ['b10-xfrin'])
xfrind = ProcessInfo("b10-xfrin", ['b10-xfrin'],
{ 'ISC_MSGQ_PORT': str(self.c_channel_port)})
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
......@@ -297,7 +299,8 @@ class BoB:
if self.verbose:
sys.stdout.write("Starting b10-cmdctl on port 8080\n")
try:
cmd_ctrld = ProcessInfo("b10-cmdctl", ['b10-cmdctl'])
cmd_ctrld = ProcessInfo("b10-cmdctl", ['b10-cmdctl'],
{ 'ISC_MSGQ_PORT': str(self.c_channel_port)})
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
......
......@@ -71,15 +71,25 @@ class SubscriptionManager:
class MsgQ:
"""Message Queue class."""
def __init__(self, c_channel_port=9912, verbose=False):
def __init__(self, port=0, verbose=False):
"""Initialize the MsgQ master.
The c_channel_port specifies the TCP/IP port that the msgq
The port specifies the TCP/IP port that the msgq
process listens on. If verbose is True, then the MsgQ reports
what it is doing.
"""
if port == 0:
if 'ISC_MSGQ_PORT' in os.environ:
port = int(os.environ["ISC_MSGQ_PORT"])
else:
port = 9912
print(port)
self.verbose = verbose
self.c_channel_port = c_channel_port
self.c_channel_port = port
self.poller = None
self.kqueue = None
self.runnable = False
......@@ -365,7 +375,7 @@ if __name__ == "__main__":
parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
help="display more about what is going on")
parser.add_option("-m", "--msgq-port", dest="msgq_port", type="string",
action="callback", callback=check_port, default="9912",
action="callback", callback=check_port, default="0",
help="port the msgq daemon will use")
(options, args) = parser.parse_args()
......
......@@ -35,7 +35,7 @@ class Session:
self._queue = []
if port == 0:
if 'B10_FROM_SOURCE' in os.environ:
if 'ISC_MSGQ_PORT' in os.environ:
port = int(os.environ["ISC_MSGQ_PORT"])
else:
port = 9912
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment