|
@@ -211,12 +211,20 @@ class ModuleCCSession(ConfigData):
|
|
|
self.__send_spec()
|
|
|
self.__request_config()
|
|
|
|
|
|
- def stop(self):
|
|
|
- """Inform the system that the module using this ModuleCCSession
|
|
|
- is stopping. This call will only cause a 'stopping'
|
|
|
- message to be sent to the ConfigManager, it does not clear or
|
|
|
- free any resources."""
|
|
|
- self.__send_stopping()
|
|
|
+ def send_stopping(self):
|
|
|
+ """Sends a 'stopping' message to the configuration manager. This
|
|
|
+ message is just an FYI, and no response is expected. Any errors
|
|
|
+ when sending this message (for instance if the msgq session has
|
|
|
+ previously been closed) are logged, but ignored."""
|
|
|
+ msg = create_command(COMMAND_MODULE_STOPPING,
|
|
|
+ self.get_module_spec().get_full_spec())
|
|
|
+ try:
|
|
|
+ self._session.group_sendmsg(msg, "ConfigManager")
|
|
|
+ except isc.cc.session.SessionError as se:
|
|
|
+ # If the session was previously closed, obvously trying to send
|
|
|
+ # a message fails. (TODO: check if session is open so we can
|
|
|
+ # error on real problems?)
|
|
|
+ logger.error(CONFIG_SESSION_STOPPING_FAILED, str(se))
|
|
|
|
|
|
def get_socket(self):
|
|
|
"""Returns the socket from the command channel session. This
|
|
@@ -380,21 +388,6 @@ class ModuleCCSession(ConfigData):
|
|
|
# TODO: log an error?
|
|
|
pass
|
|
|
|
|
|
- def __send_stopping(self):
|
|
|
- """Sends a 'stopping' message to the configuration manager. This
|
|
|
- message is just an FYI, and no response is expected. Any errors
|
|
|
- when sending this message (for instance if the msgq session has
|
|
|
- previously been closed) are logged, but ignored."""
|
|
|
- msg = create_command(COMMAND_MODULE_STOPPING,
|
|
|
- self.get_module_spec().get_full_spec())
|
|
|
- try:
|
|
|
- self._session.group_sendmsg(msg, "ConfigManager")
|
|
|
- except isc.cc.session.SessionError as se:
|
|
|
- # If the session was previously closed, obvously trying to send
|
|
|
- # a message fails. (TODO: check if session is open so we can
|
|
|
- # error on real problems?)
|
|
|
- logger.error(CONFIG_SESSION_STOPPING_FAILED, str(se))
|
|
|
-
|
|
|
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"""
|