From 163bfd0f3776400bd0a16af6ff67411e6b85b67a Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:42:19 +0100 Subject: [PATCH] [PR #9645/37a9413a backport][stable-10] proxmox: fix pubkey translation and usage in update (#9648) proxmox: fix pubkey translation and usage in update (#9645) * proxmox: fix: pubkey translation and usage in update * proxmox fix: add changelog * proxmox: fix backticks in changelog (cherry picked from commit 37a9413a80a915868637427a80637f29d1e04253) Co-authored-by: JL Euler --- changelogs/fragments/9645-proxmox-fix-pubkey.yml | 3 +++ plugins/modules/proxmox.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/9645-proxmox-fix-pubkey.yml diff --git a/changelogs/fragments/9645-proxmox-fix-pubkey.yml b/changelogs/fragments/9645-proxmox-fix-pubkey.yml new file mode 100644 index 0000000000..786daf88df --- /dev/null +++ b/changelogs/fragments/9645-proxmox-fix-pubkey.yml @@ -0,0 +1,3 @@ +bugfixes: + - proxmox - fixes a typo in the translation of the ``pubkey`` parameter to proxmox' ``ssh-public-keys`` (https://github.com/ansible-collections/community.general/issues/9642, https://github.com/ansible-collections/community.general/pull/9645). + - proxmox - adds the ``pubkey`` parameter (back to) the ``update`` state (https://github.com/ansible-collections/community.general/issues/9642, https://github.com/ansible-collections/community.general/pull/9645). diff --git a/plugins/modules/proxmox.py b/plugins/modules/proxmox.py index 5d1c8efc74..4f25b90ad0 100644 --- a/plugins/modules/proxmox.py +++ b/plugins/modules/proxmox.py @@ -1065,6 +1065,15 @@ class ProxmoxLxcAnsible(ProxmoxAnsible): if "netif" in kwargs: kwargs.update(kwargs.pop("netif")) + if "pubkey" in kwargs: + pubkey = kwargs.pop("pubkey") + if self.version() >= LooseVersion("4.2"): + kwargs["ssh-public-keys"] = pubkey + else: + self.module.warn( + "'pubkey' is not supported for PVE 4.1 and below. Ignoring keyword." + ) + # fetch current config proxmox_node = self.proxmox_api.nodes(node) current_config = getattr(proxmox_node, self.VZ_TYPE)(vmid).config.get() @@ -1215,7 +1224,7 @@ class ProxmoxLxcAnsible(ProxmoxAnsible): if "pubkey" in kwargs: pubkey = kwargs.pop("pubkey") if self.version() >= LooseVersion("4.2"): - kwargs["ssh-public-key"] = pubkey + kwargs["ssh-public-keys"] = pubkey else: self.module.warn( "'pubkey' is not supported for PVE 4.1 and below. Ignoring keyword."