vmware: vmware_vm_inventory use port value when with_tags:True (#65568)
If user specifies a port number in vmware_vm_inventory plugin configuration, then use that port to connect to vCenter rather than connecting to 443 which is default port. Fixes: #64096
This commit is contained in:
parent
b782227642
commit
c97360d21f
2 changed files with 7 additions and 2 deletions
2
changelogs/fragments/vmware_vm_inventory_port.yml
Normal file
2
changelogs/fragments/vmware_vm_inventory_port.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- vmware_vm_inventory inventory plugin, use the port value while connecting to vCenter (https://github.com/ansible/ansible/issues/64096).
|
|
@ -163,12 +163,15 @@ class BaseVMwareInventory:
|
|||
# Disable warning shown at stdout
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
client = create_vsphere_client(server=self.hostname,
|
||||
server = self.hostname
|
||||
if self.port:
|
||||
server += ":" + str(self.port)
|
||||
client = create_vsphere_client(server=server,
|
||||
username=self.username,
|
||||
password=self.password,
|
||||
session=session)
|
||||
if client is None:
|
||||
raise AnsibleError("Failed to login to %s using %s" % (self.hostname, self.username))
|
||||
raise AnsibleError("Failed to login to %s using %s" % (server, self.username))
|
||||
return client
|
||||
|
||||
def _login(self):
|
||||
|
|
Loading…
Reference in a new issue