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

rename param from skip_ssl to validate_certs

This commit is contained in:
Kamil Szczygiel 2016-02-02 15:47:56 +01:00
parent a381c1bbd6
commit fa13aa8c00

View file

@ -105,7 +105,7 @@ def vmware_argument_spec():
hostname=dict(type='str', required=True), hostname=dict(type='str', required=True),
username=dict(type='str', aliases=['user', 'admin'], required=True), username=dict(type='str', aliases=['user', 'admin'], required=True),
password=dict(type='str', aliases=['pass', 'pwd'], required=True, no_log=True), password=dict(type='str', aliases=['pass', 'pwd'], required=True, no_log=True),
skip_ssl=dict(type='bool', required=False, default=False), validate_certs=dict(type='bool', required=False, default=True),
) )
@ -114,15 +114,15 @@ def connect_to_api(module, disconnect_atexit=True):
hostname = module.params['hostname'] hostname = module.params['hostname']
username = module.params['username'] username = module.params['username']
password = module.params['password'] password = module.params['password']
skip_ssl = module.params['skip_ssl'] validate_certs = module.params['validate_certs']
try: try:
if skip_ssl: if validate_certs:
service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password)
else:
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.verify_mode = ssl.CERT_NONE context.verify_mode = ssl.CERT_NONE
service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password, sslContext=context) service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password, sslContext=context)
else:
service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password)
# Disabling atexit should be used in special cases only. # Disabling atexit should be used in special cases only.
# Such as IP change of the ESXi host which removes the connection anyway. # Such as IP change of the ESXi host which removes the connection anyway.