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