Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Oct 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/ansible/module_utils/vmware.py
Expand Up @@ -354,13 +354,11 @@ def gather_vm_facts(content, vm):
for device in vmnet:
net_dict[device.macAddress] = list(device.ipAddress)

for dummy, v in iteritems(net_dict):
for ipaddress in v:
if ipaddress:
if '::' in ipaddress:
facts['ipv6'] = ipaddress
else:
facts['ipv4'] = ipaddress
if vm.guest.ipAddress:
if ':' in vm.guest.ipAddress:
facts['ipv6'] = vm.guest.ipAddress
else:
facts['ipv4'] = vm.guest.ipAddress

ethernet_idx = 0
for entry in vm.config.hardware.device:
Expand Down