mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* add int parse handling * Revert "add int parse handling" This reverts commitdb2aac4254
. * fix: vmid check if state is absent * add changelogs fragments * Update changelogs/fragments/4945-fix-get_vm-int-parse-handling.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commitc57204f9a9
) Co-authored-by: miyuk <enough7531@gmail.com>
This commit is contained in:
parent
35092aa7f9
commit
8854f4d948
3 changed files with 7 additions and 0 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
bugfixes:
|
||||||
|
- proxmox - fix error handling when getting VM by name when ``state=absent`` (https://github.com/ansible-collections/community.general/pull/4945).
|
||||||
|
- proxmox_kvm - fix error handling when getting VM by name when ``state=absent`` (https://github.com/ansible-collections/community.general/pull/4945).
|
|
@ -743,6 +743,8 @@ def main():
|
||||||
module.fail_json(msg="restarting of VM %s failed with exception: %s" % (vmid, e))
|
module.fail_json(msg="restarting of VM %s failed with exception: %s" % (vmid, e))
|
||||||
|
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
|
if not vmid:
|
||||||
|
module.exit_json(changed=False, msg='VM with hostname = %s is already absent' % hostname)
|
||||||
try:
|
try:
|
||||||
vm = proxmox.get_vm(vmid, ignore_missing=True)
|
vm = proxmox.get_vm(vmid, ignore_missing=True)
|
||||||
if not vm:
|
if not vm:
|
||||||
|
|
|
@ -1370,6 +1370,8 @@ def main():
|
||||||
|
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
status = {}
|
status = {}
|
||||||
|
if not vmid:
|
||||||
|
module.exit_json(changed=False, msg='VM with name = %s is already absent' % name)
|
||||||
try:
|
try:
|
||||||
vm = proxmox.get_vm(vmid, ignore_missing=True)
|
vm = proxmox.get_vm(vmid, ignore_missing=True)
|
||||||
if not vm:
|
if not vm:
|
||||||
|
|
Loading…
Reference in a new issue