Skip to content

Commit

Permalink
Correctly handle exception when no VM name returned by proxmox (#4508)
Browse files Browse the repository at this point in the history
  • Loading branch information
cinek810 authored Apr 19, 2022
1 parent a8abb1a commit 8076f16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 1 addition & 1 deletion plugins/modules/cloud/misc/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8076f16

Please sign in to comment.