Huawei: disable certificate verification
Globally disable verification by monkeypatching the ssl module in version of Python that enable certificate verification by default for stdlib http clients. Change-Id: If672933e581f06ffcd4c8d64921d061f42de23dc Closes-Bug: #1672288
This commit is contained in:
parent
a55a6b5c71
commit
9ed6fac24c
@ -17,6 +17,7 @@ import json
|
||||
import re
|
||||
import six
|
||||
import socket
|
||||
import ssl
|
||||
import time
|
||||
|
||||
from oslo_log import log as logging
|
||||
@ -72,6 +73,14 @@ class RestClient(object):
|
||||
opener = urllib.request.build_opener(handler)
|
||||
urllib.request.install_opener(opener)
|
||||
res_json = None
|
||||
try:
|
||||
create_unverified_https_context = ssl._create_unverified_context
|
||||
except AttributeError:
|
||||
# Legacy Python that doesn't verify HTTPS certificates by default
|
||||
pass
|
||||
else:
|
||||
# Handle target environment that doesn't support HTTPS verification
|
||||
ssl._create_default_https_context = create_unverified_https_context
|
||||
|
||||
try:
|
||||
socket.setdefaulttimeout(calltimeout)
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
SSL certificate validation is now disabled for the Huawei driver.
|
Loading…
x
Reference in New Issue
Block a user