VMware: support for 2.6 and sslContext (#42237)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
f26272a492
commit
e8c90b47eb
1 changed files with 9 additions and 1 deletions
|
@ -501,7 +501,15 @@ def connect_to_api(module, disconnect_atexit=True):
|
||||||
|
|
||||||
service_instance = None
|
service_instance = None
|
||||||
try:
|
try:
|
||||||
service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password, sslContext=ssl_context, port=port)
|
connect_args = dict(
|
||||||
|
host=hostname,
|
||||||
|
user=username,
|
||||||
|
pwd=password,
|
||||||
|
port=port,
|
||||||
|
)
|
||||||
|
if ssl_context:
|
||||||
|
connect_args.update(sslContext=ssl_context)
|
||||||
|
service_instance = connect.SmartConnect(**connect_args)
|
||||||
except vim.fault.InvalidLogin as invalid_login:
|
except vim.fault.InvalidLogin as invalid_login:
|
||||||
module.fail_json(msg="Unable to log on to vCenter or ESXi API at %s:%s as %s: %s" % (hostname, port, username, invalid_login.msg))
|
module.fail_json(msg="Unable to log on to vCenter or ESXi API at %s:%s as %s: %s" % (hostname, port, username, invalid_login.msg))
|
||||||
except vim.fault.NoPermission as no_permission:
|
except vim.fault.NoPermission as no_permission:
|
||||||
|
|
Loading…
Reference in a new issue