mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Port the module snippet to python3 (#15870)
vca depend on pyvcloud, who depend on PyYAML 3.10, which support python 2.5 as a minimum, cf https://github.com/vmware/pyvcloud/blob/master/requirements.txt and http://pyyaml.org/wiki/PyYAML vmware.py depend on PyVIM, who depend on python 2.6. So we can use the modern syntax for both of them.
This commit is contained in:
parent
e539b2003d
commit
127a37f67c
2 changed files with 4 additions and 4 deletions
|
@ -194,9 +194,9 @@ def connect_to_api(module, disconnect_atexit=True):
|
|||
|
||||
try:
|
||||
service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password)
|
||||
except vim.fault.InvalidLogin, invalid_login:
|
||||
except vim.fault.InvalidLogin as invalid_login:
|
||||
module.fail_json(msg=invalid_login.msg, apierror=str(invalid_login))
|
||||
except requests.ConnectionError, connection_error:
|
||||
except requests.ConnectionError as connection_error:
|
||||
if '[SSL: CERTIFICATE_VERIFY_FAILED]' in str(connection_error) and not validate_certs:
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
|
||||
context.verify_mode = ssl.CERT_NONE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue