1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

VMware: Fixed vmware fact gathering when no physical interfaces have IP Addresses (#42600)

* Changed vmware_guest_facts to accuretly reflect ip as displayed in vcenter
* fixed ipv6 check
This commit is contained in:
Philip Bove 2018-10-26 13:41:58 -04:00 committed by Abhijeet Kasurde
parent 8bc4a18500
commit 055ee048ce

View file

@ -352,13 +352,11 @@ def gather_vm_facts(content, vm):
for device in vmnet: for device in vmnet:
net_dict[device.macAddress] = list(device.ipAddress) net_dict[device.macAddress] = list(device.ipAddress)
for dummy, v in iteritems(net_dict): if vm.guest.ipAddress:
for ipaddress in v: if ':' in vm.guest.ipAddress:
if ipaddress: facts['ipv6'] = vm.guest.ipAddress
if '::' in ipaddress: else:
facts['ipv6'] = ipaddress facts['ipv4'] = vm.guest.ipAddress
else:
facts['ipv4'] = ipaddress
ethernet_idx = 0 ethernet_idx = 0
for entry in vm.config.hardware.device: for entry in vm.config.hardware.device: