1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

VMware: Fix SSL Context checking for Python <2.7.9 (#33683)

Fixes: #33602

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-12-12 22:02:36 +05:30 committed by GitHub
parent 58fdbe7415
commit 73abde399c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -449,10 +449,10 @@ def connect_to_api(module, disconnect_atexit=True):
if validate_certs and not hasattr(ssl, 'SSLContext'):
module.fail_json(msg='pyVim does not support changing verification mode with python < 2.7.9. Either update '
'python or or use validate_certs=false')
'python or use validate_certs=false.')
ssl_context = None
if not validate_certs:
if not validate_certs and hasattr(ssl, 'SSLContext'):
ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ssl_context.verify_mode = ssl.CERT_NONE