Changed insecure to validate_certs, with a default to true from false (reversing behavior)
This commit is contained in:
parent
78f4979a0e
commit
edf6bf31b6
1 changed files with 7 additions and 6 deletions
|
@ -50,11 +50,12 @@ options:
|
|||
required: true
|
||||
default: null
|
||||
aliases: []
|
||||
insecure:
|
||||
validate_certs:
|
||||
description:
|
||||
- Ignore SSL verification errors when connection to vcenter
|
||||
- Validate SSL certs.
|
||||
required: false
|
||||
default: false
|
||||
default: yes
|
||||
choices: ['yes', 'no']
|
||||
guest:
|
||||
description:
|
||||
- The virtual server name you wish to manage.
|
||||
|
@ -1440,7 +1441,7 @@ def main():
|
|||
cluster=dict(required=False, default=None, type='str'),
|
||||
force=dict(required=False, type='bool', default=False),
|
||||
esxi=dict(required=False, type='dict', default={}),
|
||||
insecure=dict(required=False, type='bool', default=False),
|
||||
validate_certs=dict(required=False, type='bool', default=True),
|
||||
power_on_after_clone=dict(required=False, type='bool', default=True)
|
||||
|
||||
|
||||
|
@ -1482,7 +1483,7 @@ def main():
|
|||
from_template = module.params['from_template']
|
||||
snapshot_to_clone = module.params['snapshot_to_clone']
|
||||
power_on_after_clone = module.params['power_on_after_clone']
|
||||
insecure = module.params['insecure']
|
||||
validate_certs = module.params['validate_certs']
|
||||
|
||||
|
||||
# CONNECT TO THE SERVER
|
||||
|
@ -1490,7 +1491,7 @@ def main():
|
|||
try:
|
||||
viserver.connect(vcenter_hostname, username, password)
|
||||
except ssl.SSLError as sslerr:
|
||||
if '[SSL: CERTIFICATE_VERIFY_FAILED]' in sslerr.strerror and insecure:
|
||||
if '[SSL: CERTIFICATE_VERIFY_FAILED]' in sslerr.strerror and not validate_certs:
|
||||
default_context = ssl._create_default_https_context
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
viserver.connect(vcenter_hostname, username, password)
|
||||
|
|
Loading…
Reference in a new issue