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

VMware: Handle VMs with no configurations

Sometime VMs does not return any configurations which leads
to failing the inventory plugin.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2019-04-30 19:43:07 +05:30 committed by Gonéri Le Bouder
parent e4cca4e40a
commit 7505550500

View file

@ -411,6 +411,10 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
# VMware does not provide a way to uniquely identify VM by its name # VMware does not provide a way to uniquely identify VM by its name
# i.e. there can be two virtual machines with same name # i.e. there can be two virtual machines with same name
# Appending "_" and VMware UUID to make it unique # Appending "_" and VMware UUID to make it unique
if not vm_obj.obj.config:
# Sometime orphaned VMs return no configurations
continue
current_host = vm_obj_property.val + "_" + vm_obj.obj.config.uuid current_host = vm_obj_property.val + "_" + vm_obj.obj.config.uuid
if current_host not in hostvars: if current_host not in hostvars: