Blame SOURCES/bz1771594-2-fence_redfish-fence_vmware_soap-suppress-warning.patch

6147c0
From 559771f2c5a638f7e14ec9c0ef1068c86ee9d40e Mon Sep 17 00:00:00 2001
6147c0
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
6147c0
Date: Tue, 26 Nov 2019 14:09:14 +0100
6147c0
Subject: [PATCH] fence_redfish/fence_vmware_soap: suppress warnings correctly
6147c0
 with new python-requests
6147c0
6147c0
python-requests doesnt suppress warnings anymore, so it needs to be done in urllib3: https://stackoverflow.com/questions/27981545/suppress-insecurerequestwarning-unverified-https-request-is-being-made-in-pytho/28002687#28002687
6147c0
---
6147c0
 agents/redfish/fence_redfish.py         | 4 ++--
6147c0
 agents/vmware_soap/fence_vmware_soap.py | 4 ++--
6147c0
 2 files changed, 4 insertions(+), 4 deletions(-)
6147c0
6147c0
diff --git a/agents/redfish/fence_redfish.py b/agents/redfish/fence_redfish.py
6147c0
index 390a4827..c7c6492c 100644
6147c0
--- a/agents/redfish/fence_redfish.py
6147c0
+++ b/agents/redfish/fence_redfish.py
6147c0
@@ -12,7 +12,6 @@
6147c0
 import atexit
6147c0
 sys.path.append("@FENCEAGENTSLIBDIR@")
6147c0
 
6147c0
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
6147c0
 from fencing import *
6147c0
 from fencing import fail_usage, run_delay
6147c0
 
6147c0
@@ -143,7 +142,8 @@ def main():
6147c0
 
6147c0
     # Disable insecure-certificate-warning message
6147c0
     if "--ssl-insecure" in opt:
6147c0
-        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
6147c0
+        import urllib3
6147c0
+        urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
6147c0
 
6147c0
     # backwards compatibility for <ip>:<port>
6147c0
     if options["--ip"].count(":") == 1:
6147c0
diff --git a/agents/vmware_soap/fence_vmware_soap.py b/agents/vmware_soap/fence_vmware_soap.py
6147c0
index dd1a4ed6..53e8d8f4 100644
6147c0
--- a/agents/vmware_soap/fence_vmware_soap.py
6147c0
+++ b/agents/vmware_soap/fence_vmware_soap.py
6147c0
@@ -37,10 +37,10 @@ def soap_login(options):
6147c0
 	if "--ssl" in options or "--ssl-secure" in options or "--ssl-insecure" in options:
6147c0
 		if "--ssl-insecure" in options:
6147c0
 			import ssl
6147c0
-			from requests.packages.urllib3.exceptions import InsecureRequestWarning
6147c0
+			import urllib3
6147c0
 			if hasattr(ssl, '_create_unverified_context'):
6147c0
 				ssl._create_default_https_context = ssl._create_unverified_context
6147c0
-			requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
6147c0
+			urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
6147c0
 			verify = False
6147c0
 		else:
6147c0
 			verify = True