From b9d08649578e8a5838e532cd5f04e0ee031e13e1 Mon Sep 17 00:00:00 2001 From: Alexander Holzapfel Date: Sun, 23 Oct 2022 18:25:03 +0200 Subject: [PATCH] Send string instead of boolean to proxmox api (#5198) * Send string instead of boolean to proxmox api * Add changelog fragment. * Update plugins/modules/cloud/misc/proxmox_kvm.py Co-authored-by: castorsky Co-authored-by: Felix Fontein Co-authored-by: castorsky --- changelogs/fragments/5198-proxmox.yml | 2 ++ plugins/modules/cloud/misc/proxmox_kvm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5198-proxmox.yml diff --git a/changelogs/fragments/5198-proxmox.yml b/changelogs/fragments/5198-proxmox.yml new file mode 100644 index 0000000000..b5d7c88094 --- /dev/null +++ b/changelogs/fragments/5198-proxmox.yml @@ -0,0 +1,2 @@ +bugfixes: + - "proxmox_kvm - fix ``agent`` parameter when boolean value is specified (https://github.com/ansible-collections/community.general/pull/5198)." diff --git a/plugins/modules/cloud/misc/proxmox_kvm.py b/plugins/modules/cloud/misc/proxmox_kvm.py index ba5b0d4ff3..92aaf6a904 100644 --- a/plugins/modules/cloud/misc/proxmox_kvm.py +++ b/plugins/modules/cloud/misc/proxmox_kvm.py @@ -963,7 +963,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible): if 'agent' in kwargs: try: # The API also allows booleans instead of e.g. `enabled=1` for backward-compatibility. - kwargs['agent'] = boolean(kwargs['agent'], strict=True) + kwargs['agent'] = int(boolean(kwargs['agent'], strict=True)) except TypeError: # Not something that Ansible would parse as a boolean. pass