BIND 10 trac565, updated. 569afbc3c08776e04f1b755dce2ff5aa5c385647 [trac565] config_handler calls start and stop
BIND 10 source code commits
bind10-changes at lists.isc.org
Sun Feb 13 15:15:07 UTC 2011
The branch, trac565 has been updated
via 569afbc3c08776e04f1b755dce2ff5aa5c385647 (commit)
from 38778d44793426906ef7d0d25a70be4a36188765 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 569afbc3c08776e04f1b755dce2ff5aa5c385647
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sun Feb 13 16:14:46 2011 +0100
[trac565] config_handler calls start and stop
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10.py.in | 29 ++++++++++++++++++++++++++-
src/bin/bind10/tests/bind10_test.py | 36 +++++++++++++++-------------------
2 files changed, 43 insertions(+), 22 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10.py.in b/src/bin/bind10/bind10.py.in
index 7594b77..6551b12 100644
--- a/src/bin/bind10/bind10.py.in
+++ b/src/bin/bind10/bind10.py.in
@@ -229,6 +229,29 @@ class BoB:
if self.verbose:
sys.stdout.write("[bind10] Handling new configuration: " +
str(new_config) + "\n")
+ if 'start_resolver' in new_config:
+ if new_config['start_resolver']:
+ if self.uid is not None:
+ sys.stderr.write("[bind10] Starting resolver as a user," +
+ "not root. This might fail.\n")
+ self.start_resolver(self.c_channel_env)
+ else:
+ self.stop_resolver()
+ if 'start_auth' in new_config:
+ if new_config['start_auth']:
+ if self.uid is not None:
+ sys.stderr.write("[bind10] Starting auth as a user," +
+ "not root. This might fail.\n")
+ self.start_auth(self.c_channel_env)
+ self.start_xfrout(self.c_channel_env)
+ self.start_xfrin(self.c_channel_env)
+ self.start_zonemgr(self.c_channel_env)
+ else:
+ self.stop_zonemgr()
+ self.stop_xfrin()
+ self.stop_xfrout()
+ self.stop_auth()
+
answer = isc.config.ccsession.create_answer(0)
return answer
# TODO
@@ -477,11 +500,12 @@ class BoB:
# XXX: we hardcode port 8080
self.start_simple("b10-cmdctl", c_channel_env, 8080)
- def start_all_processes(self, c_channel_env):
+ def start_all_processes(self):
"""
Starts up all the processes. Any exception generated during the
starting of the processes is handled by the caller.
"""
+ c_channel_env = self.c_channel_env
self.start_msgq(c_channel_env)
self.start_cfgmgr(c_channel_env)
self.start_ccsession(c_channel_env)
@@ -541,7 +565,8 @@ class BoB:
# Start all processes. If any one fails to start, kill all started
# processes and exit with an error indication.
try:
- self.start_all_processes(c_channel_env)
+ self.c_channel_env = c_channel_env
+ self.start_all_processes()
except Exception as e:
self.kill_started_processes()
return "Unable to start " + self.curproc + ": " + str(e)
diff --git a/src/bin/bind10/tests/bind10_test.py b/src/bin/bind10/tests/bind10_test.py
index 8bcd447..d13d9cc 100644
--- a/src/bin/bind10/tests/bind10_test.py
+++ b/src/bin/bind10/tests/bind10_test.py
@@ -163,6 +163,7 @@ class StartAllProcessesBob(BoB):
self.zonemgr = False
self.stats = False
self.cmdctl = False
+ self.c_channel_env = {}
def read_bind10_config(self):
# Configuration options are set directly
@@ -198,34 +199,34 @@ class StartAllProcessesBob(BoB):
def start_cmdctl(self, c_channel_env):
self.cmdctl = True
- def stop_msgq(self, c_channel_env):
+ def stop_msgq(self):
self.msgq = False
- def stop_cfgmgr(self, c_channel_env):
+ def stop_cfgmgr(self):
self.cfgmgr = False
- def stop_ccsession(self, c_channel_env):
+ def stop_ccsession(self):
self.ccsession = False
- def stop_auth(self, c_channel_env):
+ def stop_auth(self):
self.auth = False
- def stop_resolver(self, c_channel_env):
+ def stop_resolver(self):
self.resolver = False
- def stop_xfrout(self, c_channel_env):
+ def stop_xfrout(self):
self.xfrout = False
- def stop_xfrin(self, c_channel_env):
+ def stop_xfrin(self):
self.xfrin = False
- def stop_zonemgr(self, c_channel_env):
+ def stop_zonemgr(self):
self.zonemgr = False
- def stop_stats(self, c_channel_env):
+ def stop_stats(self):
self.stats = False
- def stop_cmdctl(self, c_channel_env):
+ def stop_cmdctl(self):
self.cmdctl = False
class TestStartStopProcessesBob(unittest.TestCase):
@@ -316,11 +317,10 @@ class TestStartStopProcessesBob(unittest.TestCase):
self.check_preconditions(bob)
# Start processes and check what was started
- c_channel_env = {}
bob.cfg_start_auth = False
bob.cfg_start_resolver = False
- bob.start_all_processes(c_channel_env)
+ bob.start_all_processes()
self.check_started_none(bob)
# Checks the processes started when starting only the auth process
@@ -330,11 +330,10 @@ class TestStartStopProcessesBob(unittest.TestCase):
self.check_preconditions(bob)
# Start processes and check what was started
- c_channel_env = {}
bob.cfg_start_auth = True
bob.cfg_start_resolver = False
- bob.start_all_processes(c_channel_env)
+ bob.start_all_processes()
self.check_started_auth(bob)
@@ -345,11 +344,10 @@ class TestStartStopProcessesBob(unittest.TestCase):
self.check_preconditions(bob)
# Start processes and check what was started
- c_channel_env = {}
bob.cfg_start_auth = False
bob.cfg_start_resolver = True
- bob.start_all_processes(c_channel_env)
+ bob.start_all_processes()
self.check_started_resolver(bob)
@@ -360,11 +358,10 @@ class TestStartStopProcessesBob(unittest.TestCase):
self.check_preconditions(bob)
# Start processes and check what was started
- c_channel_env = {}
bob.cfg_start_auth = True
bob.cfg_start_resolver = True
- bob.start_all_processes(c_channel_env)
+ bob.start_all_processes()
self.check_started_both(bob)
@@ -380,11 +377,10 @@ class TestStartStopProcessesBob(unittest.TestCase):
# Start processes (nothing much should be started, as in
# test_start_none)
- c_channel_env = {}
bob.cfg_start_auth = False
bob.cfg_start_resolver = False
- bob.start_all_processes(c_channel_env)
+ bob.start_all_processes()
self.check_started_none(bob)
# Enable both at once
More information about the bind10-changes
mailing list