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

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