Merge pull request #15919 from camradal/devel
Fix issue with latest pyvmomi and certificate validation
This commit is contained in:
commit
aee3b2e430
1 changed files with 1 additions and 1 deletions
|
@ -196,7 +196,7 @@ def connect_to_api(module, disconnect_atexit=True):
|
||||||
service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password)
|
service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password)
|
||||||
except vim.fault.InvalidLogin as invalid_login:
|
except vim.fault.InvalidLogin as invalid_login:
|
||||||
module.fail_json(msg=invalid_login.msg, apierror=str(invalid_login))
|
module.fail_json(msg=invalid_login.msg, apierror=str(invalid_login))
|
||||||
except requests.ConnectionError as connection_error:
|
except (requests.ConnectionError, ssl.SSLError) as connection_error:
|
||||||
if '[SSL: CERTIFICATE_VERIFY_FAILED]' in str(connection_error) and not validate_certs:
|
if '[SSL: CERTIFICATE_VERIFY_FAILED]' in str(connection_error) and not validate_certs:
|
||||||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
||||||
context.verify_mode = ssl.CERT_NONE
|
context.verify_mode = ssl.CERT_NONE
|
||||||
|
|
Loading…
Reference in a new issue