Blame SOURCES/bz1654973-fence_vmware_soap-cleanup-sigterm.patch
|
|
21d5fd |
From 116fb7d1253ac31a8f174187dfe9f4a0c6546ade Mon Sep 17 00:00:00 2001
|
|
|
21d5fd |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
21d5fd |
Date: Fri, 7 Sep 2018 15:56:56 +0200
|
|
|
21d5fd |
Subject: [PATCH] fence_vmware_soap: cleanup when receiving SIGTERM
|
|
|
21d5fd |
|
|
|
21d5fd |
---
|
|
|
21d5fd |
agents/vmware_soap/fence_vmware_soap.py | 7 ++++++-
|
|
|
21d5fd |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
21d5fd |
|
|
|
21d5fd |
diff --git a/agents/vmware_soap/fence_vmware_soap.py b/agents/vmware_soap/fence_vmware_soap.py
|
|
|
21d5fd |
index b90edc9b..dd1a4ed6 100644
|
|
|
21d5fd |
--- a/agents/vmware_soap/fence_vmware_soap.py
|
|
|
21d5fd |
+++ b/agents/vmware_soap/fence_vmware_soap.py
|
|
|
21d5fd |
@@ -3,7 +3,7 @@
|
|
|
21d5fd |
import sys
|
|
|
21d5fd |
import shutil, tempfile, suds
|
|
|
21d5fd |
import logging, requests
|
|
|
21d5fd |
-import atexit
|
|
|
21d5fd |
+import atexit, signal
|
|
|
21d5fd |
sys.path.append("@FENCEAGENTSLIBDIR@")
|
|
|
21d5fd |
|
|
|
21d5fd |
from suds.client import Client
|
|
|
21d5fd |
@@ -211,6 +211,9 @@ def logout():
|
|
|
21d5fd |
except Exception:
|
|
|
21d5fd |
pass
|
|
|
21d5fd |
|
|
|
21d5fd |
+def signal_handler(signum, frame):
|
|
|
21d5fd |
+ raise Exception("Signal \"%d\" received which has triggered an exit of the process." % signum)
|
|
|
21d5fd |
+
|
|
|
21d5fd |
def main():
|
|
|
21d5fd |
global options_global
|
|
|
21d5fd |
global conn_global
|
|
|
21d5fd |
@@ -219,6 +222,8 @@ def main():
|
|
|
21d5fd |
atexit.register(atexit_handler)
|
|
|
21d5fd |
atexit.register(logout)
|
|
|
21d5fd |
|
|
|
21d5fd |
+ signal.signal(signal.SIGTERM, signal_handler)
|
|
|
21d5fd |
+
|
|
|
21d5fd |
options_global = check_input(device_opt, process_input(device_opt))
|
|
|
21d5fd |
|
|
|
21d5fd |
##
|