mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
VMware: correct logic to pass ESXi SSL thumbprint (#47600)
Due to refactoring of task_error and wait_for_task method, SSL thumbprint was lost in error message. This fixes the retry mechanism of AddHost task. Fixes: #47563 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
524c5190b8
commit
e7c83d6aa9
2 changed files with 12 additions and 4 deletions
|
@ -259,10 +259,14 @@ class VMwareHost(PyVmomi):
|
|||
return success, result
|
||||
except TaskError as task_error_exception:
|
||||
task_error = task_error_exception.args[0]
|
||||
if self.esxi_ssl_thumbprint == '' and isinstance(task_error, vim.fault.SSLVerifyFault):
|
||||
if len(task_error_exception.args) == 2:
|
||||
host_thumbprint = task_error_exception.args[1]
|
||||
else:
|
||||
host_thumbprint = None
|
||||
if self.esxi_ssl_thumbprint == '' and host_thumbprint:
|
||||
# User has not specified SSL Thumbprint for ESXi host,
|
||||
# try to grab it using SSLVerifyFault exception
|
||||
host_connect_spec.sslThumbprint = task_error.thumbprint
|
||||
host_connect_spec.sslThumbprint = host_thumbprint
|
||||
else:
|
||||
self.module.fail_json(msg="Failed to add host %s to vCenter: %s" % (self.esxi_hostname,
|
||||
to_native(task_error)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue