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
pull/9660/head
JL Euler 2025-01-29 20:29:31 +01:00 committed by GitHub
parent 8749da7756
commit 37a9413a80
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: if "netif" in kwargs:
kwargs.update(kwargs.pop("netif")) 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 # fetch current config
proxmox_node = self.proxmox_api.nodes(node) proxmox_node = self.proxmox_api.nodes(node)
current_config = getattr(proxmox_node, self.VZ_TYPE)(vmid).config.get() current_config = getattr(proxmox_node, self.VZ_TYPE)(vmid).config.get()
@ -1215,7 +1224,7 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
if "pubkey" in kwargs: if "pubkey" in kwargs:
pubkey = kwargs.pop("pubkey") pubkey = kwargs.pop("pubkey")
if self.version() >= LooseVersion("4.2"): if self.version() >= LooseVersion("4.2"):
kwargs["ssh-public-key"] = pubkey kwargs["ssh-public-keys"] = pubkey
else: else:
self.module.warn( self.module.warn(
"'pubkey' is not supported for PVE 4.1 and below. Ignoring keyword." "'pubkey' is not supported for PVE 4.1 and below. Ignoring keyword."