BIND 10 trac2855, updated. 324075cb7fd53b74e1f07950d91a63aef294e882 [2855] Add BIND10Server._shutdown_module() method for shutdown processing
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Jun 21 13:52:21 UTC 2013
The branch, trac2855 has been updated
via 324075cb7fd53b74e1f07950d91a63aef294e882 (commit)
via 6e9e21070a00197b17b66f0383b3309136020b2c (commit)
from bfbd7b2c98bac38f7144b968435435f70410d753 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 324075cb7fd53b74e1f07950d91a63aef294e882
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Jun 21 19:21:54 2013 +0530
[2855] Add BIND10Server._shutdown_module() method for shutdown processing
commit 6e9e21070a00197b17b66f0383b3309136020b2c
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Jun 21 19:17:16 2013 +0530
[2855] Fix typos
-----------------------------------------------------------------------
Summary of changes:
.../python/isc/server_common/bind10_server.py.in | 15 +++++++++++++--
.../isc/server_common/tests/bind10_server_test.py | 10 ++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/server_common/bind10_server.py.in b/src/lib/python/isc/server_common/bind10_server.py.in
index 5b57ba5..f46d772 100644
--- a/src/lib/python/isc/server_common/bind10_server.py.in
+++ b/src/lib/python/isc/server_common/bind10_server.py.in
@@ -52,8 +52,14 @@ class BIND10Server:
initialization. This is called after the module CC
session has started, and can be used for registering
interest on remote modules, etc. If it raises an
- exception, the server will be immediatelly stopped.
+ exception, the server will be immediately stopped.
Parameter: None, Return: None
+ _shutdown_module: can be optionally defined for module-specific
+ finalization. This is called right before the
+ module CC session is stopped. If it raises an
+ exception, the server shutdown will still
+ continue.
+ Parameter: None, Return: None
"""
# Will be set to True when the server should stop and shut down.
@@ -181,6 +187,7 @@ class BIND10Server:
# propagate it)
self._mod_cc.check_command(True)
+ self._shutdown_module()
self._mod_cc.send_stopping()
def _command_handler(self, cmd, args):
@@ -199,7 +206,11 @@ class BIND10Server:
return isc.config.create_answer(1, "Unknown command: " + str(cmd))
def _setup_module(self):
- """The default implementation of the module specific initilization"""
+ """The default implementation of the module specific initialization"""
+ pass
+
+ def _shutdown_module(self):
+ """The default implementation of the module specific finalization"""
pass
def watch_fileno(self, fileno, rcallback=None, wcallback=None, \
diff --git a/src/lib/python/isc/server_common/tests/bind10_server_test.py b/src/lib/python/isc/server_common/tests/bind10_server_test.py
index 7b204ad..c363164 100755
--- a/src/lib/python/isc/server_common/tests/bind10_server_test.py
+++ b/src/lib/python/isc/server_common/tests/bind10_server_test.py
@@ -166,6 +166,16 @@ class TestBIND10Server(unittest.TestCase):
self.assertTrue(self.__server.shutdown)
self.assertEqual((0, None), isc.config.parse_answer(answer))
+ def test_run_with_shutdown_module(self):
+ """Check run() with module specific shutdown method."""
+ self.shutdown_called = False
+ def check_called():
+ self.shutdown_called = True
+ self.__server.__shutdown = True
+ self.__server._shutdown_module = check_called
+ self.assertEqual(0, self.__server.run('test'))
+ self.assertTrue(self.shutdown_called)
+
def test_other_command(self):
self.__server._mod_command_handler = self.__server.mod_command_handler
answer = self.__server._command_handler('other command', None)
More information about the bind10-changes
mailing list