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

[PR #7792/0bfebde5 backport][stable-8] proxmox_kvm - state:template will check if template exists first (#7791) (#7806)

proxmox_kvm - state:template will check if template exists first (#7791) (#7792)

* proxmox_kvm - state:template will check if template exists first (#7791)

* added changelog entry

* Update changelog fragment.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 0bfebde5c9)

Co-authored-by: aaronjohnleonard <aaronjohnleonard@gmail.com>
This commit is contained in:
patchback[bot] 2024-01-01 14:36:47 +01:00 committed by GitHub
parent 395fc1e77a
commit a045d088d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- proxmox_kvm - running ``state=template`` will first check whether VM is already a template (https://github.com/ansible-collections/community.general/pull/7792).

View file

@ -1556,6 +1556,9 @@ def main():
try:
vm = proxmox.get_vm(vmid)
if vm['template'] == 1:
module.exit_json(changed=False, vmid=vmid, msg="VM %s is already a template" % vmid, **status)
if proxmox.convert_to_template(vm, force=module.params['force'], timeout=module.params['timeout']):
module.exit_json(changed=True, vmid=vmid, msg="VM %s is converting to template" % vmid, **status)
except Exception as e: