BIND 10 trac213, updated. b235b396ae97ba25d59f5981da39f1d1e4c072e6 [213] Raise when reconfiguring a component
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Oct 10 18:40:40 UTC 2011
The branch, trac213 has been updated
via b235b396ae97ba25d59f5981da39f1d1e4c072e6 (commit)
via c46aac2b5c86d037c7c3f34fbeb54d7ac0998817 (commit)
from 7d1e13b7fb6a589336cd83bef4f81fa077785beb (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 b235b396ae97ba25d59f5981da39f1d1e4c072e6
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Oct 10 20:40:03 2011 +0200
[213] Raise when reconfiguring a component
commit c46aac2b5c86d037c7c3f34fbeb54d7ac0998817
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Oct 10 20:24:58 2011 +0200
[213] Tests for changing the config
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/bind10/component.py | 14 ++++-
src/lib/python/isc/bind10/tests/component_test.py | 57 ++++++++++++++++++++-
2 files changed, 67 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/bind10/component.py b/src/lib/python/isc/bind10/component.py
index 6a39e4a..e7eb353 100644
--- a/src/lib/python/isc/bind10/component.py
+++ b/src/lib/python/isc/bind10/component.py
@@ -229,6 +229,16 @@ class Configurator:
'command': 'stop',
'component': component
})
+ # Handle transitions of configuration of what is here
+ for cname in new.keys():
+ if cname in old:
+ for option in ['special', 'process', 'kind']:
+ if new[cname].get(option) != old[cname].get(option):
+ raise NotImplementedError('Changing configuration of' +
+ ' a running component is ' +
+ 'not yet supported. Remove' +
+ ' and re-add ' + cname +
+ 'to get the same effect')
# Handle introduction of new components
plan_add = []
for cname in new.keys():
@@ -240,9 +250,7 @@ class Configurator:
creator = specials[params['special']]
component = creator(params['process'], self.__boss,
params['kind'])
- priority = 0
- if 'priority' in params:
- priority = params['priority']
+ priority = params.get('priority', 0)
# We store tuples, priority first, so we can easily sort
plan_add.append((priority, {
'component': component,
diff --git a/src/lib/python/isc/bind10/tests/component_test.py b/src/lib/python/isc/bind10/tests/component_test.py
index efe83a4..9527377 100644
--- a/src/lib/python/isc/bind10/tests/component_test.py
+++ b/src/lib/python/isc/bind10/tests/component_test.py
@@ -568,7 +568,62 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
'command': 'stop',
'component': component
}], plan)
- # TODO: More scenarios for changes between configurations are needed
+
+ # We want to switch a component. So, prepare the configurator so it
+ # holds one
+ configurator._run_plan(configurator._build_plan(self.__core, bigger))
+ # Get a different configuration with a different component
+ different = copy.copy(self.__core)
+ different['another'] = {
+ 'special': 'test',
+ 'process': 'another',
+ 'kind': 'dispensable'
+ }
+ self.log = []
+ plan = configurator._build_plan(bigger, different)
+ self.assertEqual([('another', 'init'), ('another', 'dispensable')],
+ self.log)
+ self.assertEqual(2, len(plan))
+ self.assertEqual('stop', plan[0]['command'])
+ self.assertTrue('component' in plan[0])
+ self.assertEqual('start', plan[1]['command'])
+ self.assertEqual('another', plan[1]['name'])
+ self.assertTrue('component' in plan[1])
+
+ def __do_switch(self, option, value):
+ """
+ Start it with some component and then switch the configuration of the
+ component. This will probably raise, as it is not yet supported.
+ """
+ configurator = Configurator(self)
+ compconfig = {
+ 'special': 'test',
+ 'process': 'process',
+ 'priority': 13,
+ 'kind': 'core'
+ }
+ modifiedconfig = copy.copy(compconfig)
+ modifiedconfig[option] = value
+ return configurator._build_plan({'comp': compconfig},
+ {'comp': modifiedconfig})
+
+ def test_change_config_plan(self):
+ """
+ Test changing a configuration of one component. This is not yet
+ implemented and should therefore throw.
+ """
+ self.assertRaises(NotImplementedError, self.__do_switch, 'kind',
+ 'dispensable')
+ self.assertRaises(NotImplementedError, self.__do_switch, 'special',
+ 'not_a_test')
+ self.assertRaises(NotImplementedError, self.__do_switch, 'process',
+ 'different')
+ # This does not change anything on running component, so no need to
+ # raise
+ self.assertEqual([], self.__do_switch('priority', 5))
+ # Check against false positive, if the data are the same, but different
+ # instance
+ self.assertEqual([], self.__do_switch('special', 'test'))
def test_startup(self):
"""
More information about the bind10-changes
mailing list