|
@@ -178,9 +178,20 @@ class ModuleCCSession(ConfigData):
|
|
|
"""Check whether there is a command or configuration update
|
|
|
on the channel. Call the corresponding callback function if
|
|
|
there is."""
|
|
|
- msg, env = self._session.group_recvmsg(False)
|
|
|
+ msg, env = None, None
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ try:
|
|
|
+ msg, env = self._session.group_recvmsg(False)
|
|
|
+ except isc.cc.SessionTimeout:
|
|
|
+ return
|
|
|
+
|
|
|
|
|
|
- if msg and not 'result' in msg:
|
|
|
+ if msg is not None and not 'result' in msg:
|
|
|
answer = None
|
|
|
try:
|
|
|
module_name = env['group']
|
|
@@ -252,7 +263,13 @@ class ModuleCCSession(ConfigData):
|
|
|
|
|
|
|
|
|
seq = self._session.group_sendmsg(create_command(COMMAND_GET_CONFIG, { "module_name": module_name }), "ConfigManager")
|
|
|
- answer, env = self._session.group_recvmsg(False, seq)
|
|
|
+
|
|
|
+ try:
|
|
|
+ answer, env = self._session.group_recvmsg(False, seq)
|
|
|
+ except isc.cc.SessionTimeout:
|
|
|
+ raise ModuleCCSessionError("No answer from ConfigManager when "
|
|
|
+ "asking about Remote module " +
|
|
|
+ module_name)
|
|
|
if answer:
|
|
|
rcode, value = parse_answer(answer)
|
|
|
if rcode == 0:
|
|
@@ -283,25 +300,32 @@ class ModuleCCSession(ConfigData):
|
|
|
"""Sends the data specification to the configuration manager"""
|
|
|
msg = create_command(COMMAND_MODULE_SPEC, self.get_module_spec().get_full_spec())
|
|
|
seq = self._session.group_sendmsg(msg, "ConfigManager")
|
|
|
- answer, env = self._session.group_recvmsg(False, seq)
|
|
|
+ try:
|
|
|
+ answer, env = self._session.group_recvmsg(False, seq)
|
|
|
+ except isc.cc.SessionTimeout:
|
|
|
+
|
|
|
+ pass
|
|
|
|
|
|
def __request_config(self):
|
|
|
"""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"""
|
|
|
seq = self._session.group_sendmsg(create_command(COMMAND_GET_CONFIG, { "module_name": self._module_name }), "ConfigManager")
|
|
|
- answer, env = self._session.group_recvmsg(False, seq)
|
|
|
- if answer:
|
|
|
- rcode, value = parse_answer(answer)
|
|
|
- if rcode == 0:
|
|
|
- if value != None and self.get_module_spec().validate_config(False, value):
|
|
|
- self.set_local_config(value);
|
|
|
- if self._config_handler:
|
|
|
- self._config_handler(value)
|
|
|
+ try:
|
|
|
+ answer, env = self._session.group_recvmsg(False, seq)
|
|
|
+ if answer:
|
|
|
+ rcode, value = parse_answer(answer)
|
|
|
+ if rcode == 0:
|
|
|
+ if value != None and self.get_module_spec().validate_config(False, value):
|
|
|
+ self.set_local_config(value);
|
|
|
+ if self._config_handler:
|
|
|
+ self._config_handler(value)
|
|
|
+ else:
|
|
|
+
|
|
|
+ print("[" + self._module_name + "] Error requesting configuration: " + value)
|
|
|
else:
|
|
|
-
|
|
|
- print("[" + self._module_name + "] Error requesting configuration: " + value)
|
|
|
- else:
|
|
|
- raise ModuleCCSessionError("No answer from configuration manager")
|
|
|
+ raise ModuleCCSessionError("No answer from configuration manager")
|
|
|
+ except isc.cc.SessionTimeout:
|
|
|
+ raise ModuleCCSessionError("CC Session timeout waiting for configuration manager")
|
|
|
|
|
|
|
|
|
class UIModuleCCSession(MultiConfigData):
|