Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxmox module_utils: fix get_vm int parse handling #4945

Merged
merged 5 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/4945-fix-get_vm-int-parse-handling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- proxmox - fix error handling for get vm by name when state absent (https://github.com/ansible-collections/community.general/pull/4945).
- proxmox_kvm - fix error handling for get vm by name when state absent (https://github.com/ansible-collections/community.general/pull/4945).
miyuk marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions plugins/modules/cloud/misc/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,8 @@ def main():
module.fail_json(msg="restarting of VM %s failed with exception: %s" % (vmid, e))

elif state == 'absent':
if not vmid:
module.exit_json(changed=False, msg='VM with hostname = %s is already absent' % hostname)
try:
vm = proxmox.get_vm(vmid, ignore_missing=True)
if not vm:
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/cloud/misc/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,8 @@ def main():

elif state == 'absent':
status = {}
if not vmid:
module.exit_json(changed=False, msg='VM with name = %s is already absent' % name)
try:
vm = proxmox.get_vm(vmid, ignore_missing=True)
if not vm:
Expand Down