Commit fa081c17 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

use the sequence number to get the right answer in cfgmgr and ccsession.py...

use the sequence number to get the right answer in cfgmgr and ccsession.py (and hence in modules) too 


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1449 e5f2f494-b856-4b98-b285-d166d9295462
parent ecac16e6
...@@ -249,8 +249,8 @@ class ModuleCCSession(ConfigData): ...@@ -249,8 +249,8 @@ class ModuleCCSession(ConfigData):
self._session.group_subscribe(module_name); self._session.group_subscribe(module_name);
# Get the current config for that module now # Get the current config for that module now
self._session.group_sendmsg({ "command": [ "get_config", { "module_name": module_name } ] }, "ConfigManager") seq = self._session.group_sendmsg({ "command": [ "get_config", { "module_name": module_name } ] }, "ConfigManager")
answer, env = self._session.group_recvmsg(False) answer, env = self._session.group_recvmsg(False, seq)
if answer: if answer:
rcode, value = parse_answer(answer) rcode, value = parse_answer(answer)
if rcode == 0: if rcode == 0:
...@@ -279,14 +279,14 @@ class ModuleCCSession(ConfigData): ...@@ -279,14 +279,14 @@ class ModuleCCSession(ConfigData):
def __send_spec(self): def __send_spec(self):
"""Sends the data specification to the configuration manager""" """Sends the data specification to the configuration manager"""
msg = create_command(COMMAND_MODULE_SPEC, self.get_module_spec().get_full_spec()) msg = create_command(COMMAND_MODULE_SPEC, self.get_module_spec().get_full_spec())
self._session.group_sendmsg(msg, "ConfigManager") seq = self._session.group_sendmsg(msg, "ConfigManager")
answer, env = self._session.group_recvmsg(False) answer, env = self._session.group_recvmsg(False, seq)
def __request_config(self): def __request_config(self):
"""Asks the configuration manager for the current configuration, and call the config handler if set. """Asks the configuration manager for the current configuration, and call the config handler if set.
Raises a ModuleCCSessionError if there is no answer from the configuration manager""" Raises a ModuleCCSessionError if there is no answer from the configuration manager"""
self._session.group_sendmsg({ "command": [ "get_config", { "module_name": self._module_name } ] }, "ConfigManager") seq = self._session.group_sendmsg({ "command": [ "get_config", { "module_name": self._module_name } ] }, "ConfigManager")
answer, env = self._session.group_recvmsg(False) answer, env = self._session.group_recvmsg(False, seq)
if answer: if answer:
rcode, value = parse_answer(answer) rcode, value = parse_answer(answer)
if rcode == 0: if rcode == 0:
......
...@@ -244,16 +244,16 @@ class ConfigManager: ...@@ -244,16 +244,16 @@ class ConfigManager:
if conf_part: if conf_part:
data.merge(conf_part, cmd[1]) data.merge(conf_part, cmd[1])
update_cmd = isc.config.ccsession.create_command(isc.config.ccsession.COMMAND_CONFIG_UPDATE, conf_part) update_cmd = isc.config.ccsession.create_command(isc.config.ccsession.COMMAND_CONFIG_UPDATE, conf_part)
self.cc.group_sendmsg(update_cmd, module_name) seq = self.cc.group_sendmsg(update_cmd, module_name)
answer, env = self.cc.group_recvmsg(False) answer, env = self.cc.group_recvmsg(False, seq)
else: else:
conf_part = data.set(self.config.data, module_name, {}) conf_part = data.set(self.config.data, module_name, {})
data.merge(conf_part[module_name], cmd[1]) data.merge(conf_part[module_name], cmd[1])
# send out changed info # send out changed info
update_cmd = isc.config.ccsession.create_command(isc.config.ccsession.COMMAND_CONFIG_UPDATE, conf_part[module_name]) update_cmd = isc.config.ccsession.create_command(isc.config.ccsession.COMMAND_CONFIG_UPDATE, conf_part[module_name])
self.cc.group_sendmsg(update_cmd, module_name) seq = self.cc.group_sendmsg(update_cmd, module_name)
# replace 'our' answer with that of the module # replace 'our' answer with that of the module
answer, env = self.cc.group_recvmsg(False) answer, env = self.cc.group_recvmsg(False, seq)
if answer: if answer:
rcode, val = isc.config.ccsession.parse_answer(answer) rcode, val = isc.config.ccsession.parse_answer(answer)
if rcode == 0: if rcode == 0:
...@@ -269,8 +269,8 @@ class ConfigManager: ...@@ -269,8 +269,8 @@ class ConfigManager:
for module in self.config.data: for module in self.config.data:
if module != "version" and (module not in old_data or self.config.data[module] != old_data[module]): if module != "version" and (module not in old_data or self.config.data[module] != old_data[module]):
update_cmd = isc.config.ccsession.create_command(isc.config.ccsession.COMMAND_CONFIG_UPDATE, self.config.data[module]) update_cmd = isc.config.ccsession.create_command(isc.config.ccsession.COMMAND_CONFIG_UPDATE, self.config.data[module])
self.cc.group_sendmsg(update_cmd, module) seq = self.cc.group_sendmsg(update_cmd, module)
answer, env = self.cc.group_recvmsg(False) answer, env = self.cc.group_recvmsg(False, seq)
if answer == None: if answer == None:
got_error = True got_error = True
err_list.append("No answer message from " + module) err_list.append("No answer message from " + module)
......
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