mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
VMware: vmware_vm_facts check for template config (#42354)
This fix adds additional check for getting template from virtual machine before using it. Fixes: #42011 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
committed by
ansibot
parent
24a3669662
commit
cb1396b5be
@@ -151,9 +151,10 @@ class VmwareVmFacts(PyVmomi):
|
||||
}
|
||||
|
||||
vm_type = self.module.params.get('vm_type')
|
||||
if vm_type == 'vm' and vm.config.template is False:
|
||||
is_template = _get_vm_prop(vm, ('config', 'template'))
|
||||
if vm_type == 'vm' and not is_template:
|
||||
_virtual_machines.update(virtual_machine)
|
||||
elif vm_type == 'template' and vm.config.template:
|
||||
elif vm_type == 'template' and is_template:
|
||||
_virtual_machines.update(virtual_machine)
|
||||
elif vm_type == 'all':
|
||||
_virtual_machines.update(virtual_machine)
|
||||
|
||||
Reference in New Issue
Block a user