VMware: filter VMs of Same name on the basis of folder (#65922)

vmware_guest now filters VMs of same name on the basis of additional information of folder.
pull/64482/head
ngp-star 5 years ago committed by Abhijeet Kasurde
parent 50eb4eec90
commit 4769d731ac

@ -0,0 +1,2 @@
bugfixes:
- Vmware Fix for Create overwrites a VM of same name even when the folder is different(https://github.com/ansible/ansible/issues/43161)

@ -1053,7 +1053,11 @@ class PyVmomi(object):
break
elif vms:
# Unique virtual machine found.
vm_obj = vms[0]
actual_vm_folder_path = self.get_vm_path(content=self.content, vm_name=vms[0])
if self.params.get('folder') is None:
vm_obj = vms[0]
elif self.params['folder'] in actual_vm_folder_path:
vm_obj = vms[0]
elif 'moid' in self.params and self.params['moid']:
vm_obj = VmomiSupport.templateOf('VirtualMachine')(self.params['moid'], self.si._stub)

Loading…
Cancel
Save