Commit 719a5941 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1643] Small fixes

* The get_remote_config_value returns tupple.
* The config callback should be called after the module is ready.
parent ac91cd88
......@@ -344,17 +344,19 @@ class ModuleCCSession(ConfigData):
raise ModuleCCSessionError("No answer from ConfigManager when "
"asking about Remote module " +
call_callback = False
if answer:
rcode, value = parse_answer(answer)
if rcode == 0:
if value != None and module_spec.validate_config(False, value):
if config_update_callback is not None:
config_update_callback(value, module_cfg)
call_callback = True
# all done, add it
self._remote_module_configs[module_name] = module_cfg
self._remote_module_callbacks[module_name] = config_update_callback
if call_callback and config_update_callback is not None:
config_update_callback(value, module_cfg)
def add_remote_config_by_name(self, module_name,
......@@ -43,7 +43,7 @@ class Session(MockModuleCCSession):
def get_remote_config_value(self, module, name):
if module != 'tsig_keys' or name != 'keys':
raise Exception("Asked for bad data element")
return self._data
return (self._data, False)
class TSIGKeyRingTest(unittest.TestCase):
......@@ -50,15 +50,19 @@ class Updater:
session.add_remote_config_by_name('tsig_keys', self._update)
def _update(self):
def _update(self, value=None, module_cfg=None):
Update the key ring by the configuration.
Note that this function is used as a callback, but can raise
on bad data. The bad data is expected to be handled by the
configuration plugin and not be allowed as far as here.
The parameters are there just to match the signature which
the callback should have (eg. they are ignored).
data = self._session.get_remote_config_value('tsig_keys', 'keys')
(data, default) = self._session.get_remote_config_value('tsig_keys',
if data is not None: # There's an update
keyring = isc.dns.TSIGKeyRing()
for key_data in data:
Supports Markdown
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