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

add int parse handling

This commit is contained in:
miyuk 2022-07-12 11:48:32 +09:00
parent bf94f08bc4
commit db2aac4254

View file

@ -127,7 +127,8 @@ class ProxmoxAnsible(object):
return vms[0]
def get_vm(self, vmid, ignore_missing=False):
vms = [vm for vm in self.proxmox_api.cluster.resources.get(type='vm') if vm['vmid'] == int(vmid)]
vmid = int(vmid) if vmid is not None else None
vms = [vm for vm in self.proxmox_api.cluster.resources.get(type='vm') if vmid and vm['vmid'] == vmid]
if vms:
return vms[0]