From 5a93168d887b23148efb12700adddac6bff51de4 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 07:48:33 +0200 Subject: [PATCH] Fix Proxmox `node`, `name` condition. (#5108) (#5110) * Fix Proxmox `node`, `name` condition. * Add changelog entry. (cherry picked from commit 0338eb7a7c4f28882ea2df57192b9b8c0093a1ec) Co-authored-by: Markus Reiter --- changelogs/fragments/5108-proxmox-node-name-condition.yml | 2 ++ plugins/modules/cloud/misc/proxmox_kvm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5108-proxmox-node-name-condition.yml diff --git a/changelogs/fragments/5108-proxmox-node-name-condition.yml b/changelogs/fragments/5108-proxmox-node-name-condition.yml new file mode 100644 index 0000000000..e5d2aef89a --- /dev/null +++ b/changelogs/fragments/5108-proxmox-node-name-condition.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox_kvm - fix wrong condition (https://github.com/ansible-collections/community.general/pull/5108). diff --git a/plugins/modules/cloud/misc/proxmox_kvm.py b/plugins/modules/cloud/misc/proxmox_kvm.py index 774a926f59..90e9a14e6a 100644 --- a/plugins/modules/cloud/misc/proxmox_kvm.py +++ b/plugins/modules/cloud/misc/proxmox_kvm.py @@ -1234,7 +1234,7 @@ def main(): module.exit_json(changed=False, vmid=vmid, msg="VM with vmid <%s> already exists" % vmid) elif proxmox.get_vmid(name, ignore_missing=True) and not (update or clone): module.exit_json(changed=False, vmid=proxmox.get_vmid(name), msg="VM with name <%s> already exists" % name) - elif not (node, name): + elif (not node) or (not name): module.fail_json(msg='node, name is mandatory for creating/updating vm') elif not proxmox.get_node(node): module.fail_json(msg="node '%s' does not exist in cluster" % node)