[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 37a9413a80)

Co-authored-by: JL Euler <Lithimlin@users.noreply.github.com>
pull/9655/head
patchback[bot] 2025-01-29 20:42:19 +01:00 committed by GitHub
parent 0331798f84
commit 163bfd0f37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -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).

View File

@ -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."