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

add range_start and range_end agrs when query vm by a single id (#50056)

This commit is contained in:
Youhua Li 2018-12-19 22:51:20 -08:00 committed by ansibot
parent 4a82ea8392
commit 53eb3ad1e8

View file

@ -614,12 +614,12 @@ def get_vm_by_id(client, vm_id):
# -2: All vms user can Use
# -1: Vms belonging to the user and any of his groups - default
# >= 0: UID User's vms
pool.info(filter=-2)
pool.info(filter=-2, range_start=int(vm_id), range_end=int(vm_id))
for vm in pool:
if str(vm.id) == str(vm_id):
return vm
return None
if len(pool) == 1:
return pool[0]
else:
return None
def get_vms_by_ids(module, client, state, ids):