BIND 10 trac810, updated. def088d4e8387e8d04fc0fc0e56a9db39e3ccefa [trac810] Provide a notification on virtual config
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Apr 13 17:12:55 UTC 2011
The branch, trac810 has been updated
via def088d4e8387e8d04fc0fc0e56a9db39e3ccefa (commit)
from 4578fa114fea13eae53713b5282f5e906a71fbf6 (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 def088d4e8387e8d04fc0fc0e56a9db39e3ccefa
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Apr 13 19:09:12 2011 +0200
[trac810] Provide a notification on virtual config
The notification is used even when the config is not checked by remote
config. So we send it out in case of virtual module as well, but don't
wait for the answer.
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/config/cfgmgr.py | 11 ++++++++---
src/lib/python/isc/config/tests/cfgmgr_test.py | 16 +++++++++++++---
2 files changed, 21 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/config/cfgmgr.py b/src/lib/python/isc/config/cfgmgr.py
index 3b6d278..36da2c6 100644
--- a/src/lib/python/isc/config/cfgmgr.py
+++ b/src/lib/python/isc/config/cfgmgr.py
@@ -322,12 +322,19 @@ class ConfigManager:
data.merge(conf_part[module_name], cmd)
use_part = conf_part[module_name]
+ # The command to send
+ update_cmd = ccsession.create_command(ccsession.COMMAND_CONFIG_UPDATE,
+ use_part)
+
if module_name in self.virtual_modules:
# The module is virtual, so call it to get the answer
try:
error = self.virtual_modules[module_name](use_part)
if error is None:
answer = ccsession.create_answer(0)
+ # OK, it is successful, send the notify, but don't wait
+ # for answer
+ seq = self.cc.group_sendmsg(update_cmd, module_name)
else:
answer = ccsession.create_answer(1, error)
# Make sure just a validating plugin don't kill the whole manager
@@ -336,9 +343,7 @@ class ConfigManager:
answer = ccsession.create_answer(1, "Exception: " + str(excp))
else:
# Real module, send it over the wire to it
- # send out changed info
- update_cmd = ccsession.create_command(
- ccsession.COMMAND_CONFIG_UPDATE, use_part)
+ # send out changed info and wait for answer
seq = self.cc.group_sendmsg(update_cmd, module_name)
try:
# replace 'our' answer with that of the module
diff --git a/src/lib/python/isc/config/tests/cfgmgr_test.py b/src/lib/python/isc/config/tests/cfgmgr_test.py
index 6d8f3a5..b06db31 100644
--- a/src/lib/python/isc/config/tests/cfgmgr_test.py
+++ b/src/lib/python/isc/config/tests/cfgmgr_test.py
@@ -353,9 +353,8 @@ class TestConfigManager(unittest.TestCase):
# Register our virtual module
self.cm.set_virtual_module(self.spec, check_test)
- # The fake session will throw now if it is touched, as there's no
- # message or answer ready. Handy, we don't need any code about it
- # to check explicitly.
+ # The fake session will throw now if it tries to read a response.
+ # Handy, we don't need to find a complicated way to check for it.
result = self.cm._handle_set_config_module(self.spec.
get_module_name(),
{'item1': value})
@@ -363,6 +362,17 @@ class TestConfigManager(unittest.TestCase):
# With correct data
self.assertEqual(self.called_with['item1'], value)
self.assertEqual(result, {'result': expectedResult})
+ if expectedResult[0] == 0:
+ # Check it provided the correct notification
+ self.assertEqual(len(self.fake_session.message_queue), 1)
+ self.assertEqual({'command': [ 'config_update',
+ {'item1': value}]},
+ self.fake_session.get_message('Spec2', None))
+ # and the queue should now be empty again
+ self.assertEqual(len(self.fake_session.message_queue), 0)
+ else:
+ # It shouldn't send anything on error
+ self.assertEqual(len(self.fake_session.message_queue), 0)
# Success
single_test(5, lambda: None, [0])
More information about the bind10-changes
mailing list