Commit 52660589 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac565] Nothing started by config before startup

parent a3032181
...@@ -228,6 +228,9 @@ class BoB: ...@@ -228,6 +228,9 @@ class BoB:
self.verbose = verbose self.verbose = verbose
def config_handler(self, new_config): def config_handler(self, new_config):
# This is initial update, don't do anything by it, leave it to startup
if not self.runnable:
return
if self.verbose: if self.verbose:
sys.stdout.write("[bind10] Handling new configuration: " + sys.stdout.write("[bind10] Handling new configuration: " +
str(new_config) + "\n") str(new_config) + "\n")
......
...@@ -381,6 +381,7 @@ class TestStartStopProcessesBob(unittest.TestCase): ...@@ -381,6 +381,7 @@ class TestStartStopProcessesBob(unittest.TestCase):
bob.cfg_start_resolver = False bob.cfg_start_resolver = False
bob.start_all_processes() bob.start_all_processes()
bob.runnable = True
self.check_started_none(bob) self.check_started_none(bob)
# Enable both at once # Enable both at once
...@@ -444,6 +445,7 @@ class TestStartStopProcessesBob(unittest.TestCase): ...@@ -444,6 +445,7 @@ class TestStartStopProcessesBob(unittest.TestCase):
bob.cfg_start_resolver = True bob.cfg_start_resolver = True
bob.start_all_processes() bob.start_all_processes()
bob.runnable = True
self.check_started_both(bob) self.check_started_both(bob)
bob.start_auth = lambda: self.fail("Started auth again") bob.start_auth = lambda: self.fail("Started auth again")
...@@ -456,5 +458,21 @@ class TestStartStopProcessesBob(unittest.TestCase): ...@@ -456,5 +458,21 @@ class TestStartStopProcessesBob(unittest.TestCase):
bob.config_handler({'start_auth': True}) bob.config_handler({'start_auth': True})
bob.config_handler({'start_resolver': True}) bob.config_handler({'start_resolver': True})
def test_config_not_started_early(self):
"""
Test that processes are not started by the config handler before
startup.
"""
bob = StartAllProcessesBob()
self.check_preconditions(bob)
bob.start_auth = lambda: self.fail("Started auth again")
bob.start_xfrout = lambda: self.fail("Started xfrout again")
bob.start_xfrin = lambda: self.fail("Started xfrin again")
bob.start_zonemgr = lambda: self.fail("Started zonemgr again")
bob.start_resolver = lambda: self.fail("Started resolver again")
bob.config_handler({'start_auth': True, 'start_resolver': True})
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
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