]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Adding signal handler
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 30 Oct 2018 13:46:20 +0000 (14:46 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 30 Oct 2018 13:46:20 +0000 (14:46 +0100)
lib/cr_vmware_tpl/handler.py
python_fb_tools

index b78f2332bbc4bf7ab140065883536721f3196665..12ff07e896b4ef0efdd460e072a086866c11c622 100644 (file)
@@ -18,6 +18,7 @@ import time
 import datetime
 import socket
 import textwrap
+import signal
 
 # Third party modules
 import pytz
@@ -34,6 +35,7 @@ from fb_tools.common import pp, to_str
 from fb_tools.errors import HandlerError, ExpectedHandlerError, CommandNotFoundError
 from fb_tools.errors import TerraformVmError, TerraformVmDefinitionError, NetworkNotExistingError
 from fb_tools.errors import CannotConnectVsphereError, NoDatastoreFoundError
+from fb_tools.errors import InterruptError
 
 from fb_tools.handler import BaseHandler
 
@@ -132,7 +134,16 @@ class CrTplHandler(BaseHandler):
 
         retval = 0
         try:
+
+            signal.signal(signal.SIGHUP, self.signal_handler)
+            signal.signal(signal.SIGINT, self.signal_handler)
+            signal.signal(signal.SIGABRT, self.signal_handler)
+            signal.signal(signal.SIGTERM, self.signal_handler)
+            signal.signal(signal.SIGUSR1, self.signal_handler)
+            signal.signal(signal.SIGUSR2, self.signal_handler)
+
             retval = self.run()
+
         finally:
             # Aufräumen ...
             self.cluster = None
index 2b6f3b0911761160a386a005d092cd71da7aaf71..04957bbf0e37188bcc008dd8d12ed6643cb03da7 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2b6f3b0911761160a386a005d092cd71da7aaf71
+Subproject commit 04957bbf0e37188bcc008dd8d12ed6643cb03da7