BIND 10 trac213, updated. 44160936a4c52ebaf4be6e1f0fcc02c84c7fb719 [213] Use component.kill instead of os.kill
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Oct 24 19:13:24 UTC 2011
The branch, trac213 has been updated
via 44160936a4c52ebaf4be6e1f0fcc02c84c7fb719 (commit)
from db063ad7e102eafe75bda392197e9653be95bea4 (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 44160936a4c52ebaf4be6e1f0fcc02c84c7fb719
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Oct 24 20:59:22 2011 +0200
[213] Use component.kill instead of os.kill
And add a test to see it.
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10_src.py.in | 6 +++---
src/bin/bind10/tests/bind10_test.py.in | 25 +++++++++++++++++++++++++
2 files changed, 28 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index 9ff45be..bbb0eac 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -345,7 +345,7 @@ class BoB:
for pid in self.processes:
logger.info(BIND10_KILL_PROCESS, self.processes[pid].name())
- os.kill(self.processes[pid].pid(), signal.SIGTERM)
+ self.processes[pid].kill()
self.processes = {}
if self._component_configurator.running():
self._component_configurator.shutdown()
@@ -652,7 +652,7 @@ class BoB:
logger.info(BIND10_SEND_SIGTERM, component.name(),
component.pid())
try:
- os.kill(component.pid(), signal.SIGTERM)
+ component.kill()
except OSError:
# ignore these (usually ESRCH because the child
# finally exited)
@@ -675,7 +675,7 @@ class BoB:
logger.info(BIND10_SEND_SIGKILL, component.name(),
component.pid())
try:
- os.kill(component.pid(), signal.SIGKILL)
+ component.kill(True)
except OSError:
# ignore these (usually ESRCH because the child
# finally exited)
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 9523241..e67d13b 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -311,6 +311,31 @@ class TestBossComponents(unittest.TestCase):
bob._component_configurator.shutdown = orig
self.assertTrue(self.__called)
+ def test_kills(self):
+ """
+ Test that the boss kills processes which don't want to stop.
+ """
+ bob = MockBob()
+ killed = []
+ class ImmortalComponent:
+ """
+ An immortal component. It does not stop when it is told so
+ (anyway it is not told so). It does not die if it is killed
+ the first time. It dies only when killed forcefully.
+ """
+ def kill(self, forcefull=False):
+ killed.append(forcefull)
+ if forcefull:
+ bob.processes = {}
+ def pid(self):
+ return 1
+ def name(self):
+ return "Immortal"
+ bob.processes = {}
+ bob.register_process(1, ImmortalComponent())
+ bob.shutdown()
+ self.assertEqual([False, True], killed)
+
def test_init_config(self):
"""
Test initial configuration is loaded.
More information about the bind10-changes
mailing list