VMware: Simplifying get_vm() in module_utils.vmware (#62217)

pull/64832/head
Jiri Tyr 5 years ago committed by Abhijeet Kasurde
parent 46a6c28bb0
commit e0373a73a8

@ -970,12 +970,10 @@ class PyVmomi(object):
vms = []
for temp_vm_object in objects:
if len(temp_vm_object.propSet) != 1:
continue
for temp_vm_object_property in temp_vm_object.propSet:
if temp_vm_object_property.val == self.params['name']:
if (
len(temp_vm_object.propSet) == 1 and
temp_vm_object.propSet[0].val == self.params['name']):
vms.append(temp_vm_object.obj)
break
# get_managed_objects_properties may return multiple virtual machine,
# following code tries to find user desired one depending upon the folder specified.

Loading…
Cancel
Save