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

Correctly handle exception when no VM name returned by proxmox (#4508)

This commit is contained in:
Marcin 2022-04-19 18:31:12 +02:00 committed by GitHub
parent a8abb1a5bf
commit 8076f16aa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- proxmox_kvm - fix a bug when getting a state of VM without name will fail (https://github.com/ansible-collections/community.general/pull/4508).

View file

@ -1397,7 +1397,7 @@ def main():
module.fail_json(msg='VM with name = %s does not exist in cluster' % name)
vm = proxmox.get_vm(vmid)
if not name:
name = vm['name']
name = vm.get('name', '(unnamed)')
current = proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).status.current.get()['status']
status['status'] = current
if status: