[svn] commit: r1913 - in /branches/trac183/src: bin/bind10/bind10.py.in bin/bind10/run_bind10.sh.in bin/bind10/tests/bind10_test.py lib/cc/session.cc lib/python/isc/cc/session.py.in
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue May 25 10:22:56 UTC 2010
Author: jelte
Date: Tue May 25 10:22:55 2010
New Revision: 1913
Log:
removed some leftover prints
bob now only passes environment variable if it is set to non-default
fixed test for alternate domainsock instead of port
Modified:
branches/trac183/src/bin/bind10/bind10.py.in
branches/trac183/src/bin/bind10/run_bind10.sh.in
branches/trac183/src/bin/bind10/tests/bind10_test.py
branches/trac183/src/lib/cc/session.cc
branches/trac183/src/lib/python/isc/cc/session.py.in
Modified: branches/trac183/src/bin/bind10/bind10.py.in
==============================================================================
--- branches/trac183/src/bin/bind10/bind10.py.in (original)
+++ branches/trac183/src/bin/bind10/bind10.py.in Tue May 25 10:22:55 2010
@@ -222,7 +222,9 @@
"""
# try to connect to the c-channel daemon,
# to see if it is already running
- c_channel_env = { "BIND10_MSGQ_SOCKET_FILE": self.msgq_socket_file }
+ c_channel_env = {}
+ if self.msgq_socket_file is not None:
+ c_channel_env["BIND10_MSGQ_SOCKET_FILE"] = self.msgq_socket_file
if self.verbose:
sys.stdout.write("Checking for already running b10-msgq\n")
# try to connect, and if we can't wait a short while
@@ -234,8 +236,8 @@
# start the c-channel daemon
if self.verbose:
- sys.stdout.write("Starting b10-msgq using domain socket %s\n" %
- self.msgq_socket_file)
+ if self.msgq_socket_file:
+ sys.stdout.write("Starting b10-msgq\n")
try:
c_channel = ProcessInfo("b10-msgq", ["b10-msgq"], c_channel_env,
True, not self.verbose)
@@ -264,7 +266,7 @@
sys.stdout.write("[bind10] Starting b10-cfgmgr\n")
try:
bind_cfgd = ProcessInfo("b10-cfgmgr", ["b10-cfgmgr"],
- { 'BIND10_MSGQ_SOCKET_FILE': str(self.msgq_socket_file)})
+ c_channel_env)
except Exception as e:
c_channel.process.kill()
return "Unable to start b10-cfgmgr; " + str(e)
@@ -292,7 +294,7 @@
sys.stdout.write("Starting b10-xfrout\n")
try:
xfrout = ProcessInfo("b10-xfrout", ["b10-xfrout"],
- { 'BIND10_MSGQ_SOCKET_FILE': str(self.msgq_socket_file)})
+ c_channel_env )
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
@@ -310,7 +312,7 @@
authargs += ['-v']
try:
auth = ProcessInfo("b10-auth", authargs,
- { 'BIND10_MSGQ_SOCKET_FILE': str(self.msgq_socket_file)})
+ c_channel_env)
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
@@ -325,7 +327,7 @@
sys.stdout.write("Starting b10-xfrin\n")
try:
xfrind = ProcessInfo("b10-xfrin", ['b10-xfrin'],
- { 'BIND10_MSGQ_SOCKET_FILE': str(self.msgq_socket_file)})
+ c_channel_env)
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
@@ -342,7 +344,7 @@
sys.stdout.write("Starting b10-cmdctl on port 8080\n")
try:
cmd_ctrld = ProcessInfo("b10-cmdctl", ['b10-cmdctl'],
- { 'BIND10_MSGQ_SOCKET_FILE': str(self.msgq_socket_file)})
+ c_channel_env)
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
@@ -585,7 +587,7 @@
action="callback", callback=check_port, default="5300",
help="port the b10-auth daemon will use (default 5300)")
parser.add_option("-m", "--msgq-socket-file", dest="msgq_socket_file",
- type="string", default=isc.cc.Session.SOCKET_FILE,
+ type="string", default=None,
help="UNIX domain socket file the b10-msgq daemon will use")
(options, args) = parser.parse_args()
Modified: branches/trac183/src/bin/bind10/run_bind10.sh.in
==============================================================================
--- branches/trac183/src/bin/bind10/run_bind10.sh.in (original)
+++ branches/trac183/src/bin/bind10/run_bind10.sh.in Tue May 25 10:22:55 2010
@@ -29,6 +29,9 @@
B10_FROM_SOURCE=@abs_top_srcdir@
export B10_FROM_SOURCE
+BIND10_MSGQ_SOCKET_FILE=@abs_top_srcdir@/msgq_socket
+export BIND10_MSGQ_SOCKET_FILE
+
cd ${BIND10_PATH}
exec ${PYTHON_EXEC} -O bind10 $*
Modified: branches/trac183/src/bin/bind10/tests/bind10_test.py
==============================================================================
--- branches/trac183/src/bin/bind10/tests/bind10_test.py (original)
+++ branches/trac183/src/bin/bind10/tests/bind10_test.py Tue May 25 10:22:55 2010
@@ -75,16 +75,16 @@
def test_init(self):
bob = BoB()
self.assertEqual(bob.verbose, False)
- self.assertEqual(bob.c_channel_port, 9912)
+ self.assertEqual(bob.msgq_socket_file, None)
self.assertEqual(bob.cc_session, None)
self.assertEqual(bob.processes, {})
self.assertEqual(bob.dead_processes, {})
self.assertEqual(bob.runnable, False)
- def test_init_alternate_port(self):
- bob = BoB(2199)
+ def test_init_alternate_socket(self):
+ bob = BoB("alt_socket_file")
self.assertEqual(bob.verbose, False)
- self.assertEqual(bob.c_channel_port, 2199)
+ self.assertEqual(bob.msgq_socket_file, "alt_socket_file")
self.assertEqual(bob.cc_session, None)
self.assertEqual(bob.processes, {})
self.assertEqual(bob.dead_processes, {})
Modified: branches/trac183/src/lib/cc/session.cc
==============================================================================
--- branches/trac183/src/lib/cc/session.cc (original)
+++ branches/trac183/src/lib/cc/session.cc Tue May 25 10:22:55 2010
@@ -14,6 +14,7 @@
// $Id$
+#include "session_config.h"
#include "config.h"
#include <stdint.h>
@@ -231,7 +232,8 @@
}
sun.sun_family = AF_UNIX;
- strncpy(sun.sun_path, socket_file, 107);
+ strncpy(sun.sun_path, socket_file, sizeof(sun.sun_path) - 1);
+ sun.sun_path[sizeof(sun.sun_path) - 1] = '\0';
if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
close(s);
Modified: branches/trac183/src/lib/python/isc/cc/session.py.in
==============================================================================
--- branches/trac183/src/lib/python/isc/cc/session.py.in (original)
+++ branches/trac183/src/lib/python/isc/cc/session.py.in Tue May 25 10:22:55 2010
@@ -52,13 +52,9 @@
try:
self._socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- print("[XX] SOCKET FILE TO CONNECT TO: " + str(self.socket_file))
self._socket.connect(self.socket_file)
- print("[XX] CONNECTED")
self.sendmsg({ "type": "getlname" })
- print("[XX] MSG SENT")
env, msg = self.recvmsg(False)
- print("[XX] MSG RECEIVED")
if not env:
raise ProtocolError("Could not get local name")
self._lname = msg["lname"]
More information about the bind10-changes
mailing list