Browse Source

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
Jelte Jansen 15 years ago
parent
commit
fa081c17eb
2 changed files with 12 additions and 12 deletions
  1. 6 6
      src/lib/python/isc/config/ccsession.py
  2. 6 6
      src/lib/python/isc/config/cfgmgr.py

+ 6 - 6
src/lib/python/isc/config/ccsession.py

@@ -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):
     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:

+ 6 - 6
src/lib/python/isc/config/cfgmgr.py

@@ -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:
             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)