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