BIND 10 trac565, updated. 60f301c235b9d83b7fde6f06abac18d0a1168260 [trac565] Less duplicates in config_handler
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Feb 23 14:39:13 UTC 2011
The branch, trac565 has been updated
via 60f301c235b9d83b7fde6f06abac18d0a1168260 (commit)
via 4a8925ec51c064a456795ba17042bdf30ff2b8ab (commit)
from 34d182ec09a5674e87470772cce024d49043cbd9 (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 60f301c235b9d83b7fde6f06abac18d0a1168260
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Feb 23 15:38:46 2011 +0100
[trac565] Less duplicates in config_handler
commit 4a8925ec51c064a456795ba17042bdf30ff2b8ab
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Feb 23 15:38:30 2011 +0100
[trac565] Fix extra self in params
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10.py.in | 56 ++++++++++++++++++----------------
src/bin/bind10/tests/bind10_test.py | 10 +++---
2 files changed, 35 insertions(+), 31 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10.py.in b/src/bin/bind10/bind10.py.in
index 221ed83..d72d7eb 100644
--- a/src/bin/bind10/bind10.py.in
+++ b/src/bin/bind10/bind10.py.in
@@ -235,34 +235,38 @@ 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 not self.started_resolver_family:
+ def start_stop(name, started, start, stop):
+ if not'start_' + name in new_config:
+ return
+ if new_config['start_' + name]:
+ if not started:
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)
- self.started_resolver_family = True
+ sys.stderr.write("[bind10] Starting " + name + " as " +
+ "a user, not root. This might fail.\n")
+ start()
else:
- self.stop_resolver()
- self.started_resolver_family = False
- if 'start_auth' in new_config:
- if new_config['start_auth']:
- if not self.started_auth_family:
- 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)
- self.started_auth_family = True
- else:
- self.stop_zonemgr()
- self.stop_xfrin()
- self.stop_xfrout()
- self.stop_auth()
- self.started_auth_family = False
+ stop()
+ def resolver_on():
+ self.start_resolver(self.c_channel_env)
+ self.started_resolver_family = True
+ def resolver_off():
+ self.stop_resolver()
+ self.started_resolver_family = False
+ start_stop('resolver', self.started_resolver_family, resolver_on,
+ resolver_off)
+ def auth_on():
+ 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)
+ self.started_auth_family = True
+ def auth_off():
+ self.stop_zonemgr()
+ self.stop_xfrin()
+ self.stop_xfrout()
+ self.stop_auth()
+ self.started_auth_family = False
+ start_stop('auth', self.started_auth_family, auth_on, auth_off)
answer = isc.config.ccsession.create_answer(0)
return answer
diff --git a/src/bin/bind10/tests/bind10_test.py b/src/bin/bind10/tests/bind10_test.py
index 392748c..70ffdfa 100644
--- a/src/bin/bind10/tests/bind10_test.py
+++ b/src/bin/bind10/tests/bind10_test.py
@@ -257,33 +257,33 @@ class TestStartStopProcessesBob(unittest.TestCase):
self.assertEqual(bob.cmdctl, core)
def check_preconditions(self, bob):
- self.check_started(self, bob, False, False, False)
+ self.check_started(bob, False, False, False)
def check_started_none(self, bob):
"""
Check that the situation is according to configuration where no servers
should be started. Some processes still need to be running.
"""
- self.check_started(self, bob, True, False, False)
+ self.check_started(bob, True, False, False)
def check_started_both(self, bob):
"""
Check the situation is according to configuration where both servers
(auth and resolver) are enabled.
"""
- self.check_started(self, bob, True, True, True)
+ self.check_started(bob, True, True, True)
def check_started_auth(self, bob):
"""
Check the set of processes needed to run auth only is started.
"""
- self.check_started(self, bob, True, True, False)
+ self.check_started(bob, True, True, False)
def check_started_resolver(self, bob):
"""
Check the set of processes needed to run resolver only is started.
"""
- self.check_started(self, bob, True, False, True)
+ self.check_started(bob, True, False, True)
# Checks the processes started when starting neither auth nor resolver
# is specified.
More information about the bind10-changes
mailing list