mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-05 07:49:10 -07:00
VMware: use UUID to find templates and VMs (#45208)
This fix adds functionality to find the templates or VMs for cloning operations. Fixes: #45081 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
d61b4492cf
commit
d41e568a4d
2 changed files with 6 additions and 1 deletions
|
@ -975,7 +975,7 @@ class PyVmomi(object):
|
|||
|
||||
def get_vm_or_template(self, template_name=None):
|
||||
"""
|
||||
Function to find the virtual machine or virtual machine template using name
|
||||
Find the virtual machine or virtual machine template using name
|
||||
used for cloning purpose.
|
||||
Args:
|
||||
template_name: Name of virtual machine or virtual machine template
|
||||
|
@ -986,6 +986,10 @@ class PyVmomi(object):
|
|||
template_obj = None
|
||||
|
||||
if template_name:
|
||||
template_obj = find_vm_by_id(self.content, vm_id=template_name, vm_id_type="uuid")
|
||||
if template_obj:
|
||||
return template_obj
|
||||
|
||||
objects = self.get_managed_objects_properties(vim_type=vim.VirtualMachine, properties=['name'])
|
||||
templates = []
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue