Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxmox: fix pubkey translation and usage in update #9645

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/9645-proxmox-fix-pubkey.yml
Original file line number Diff line number Diff line change
@@ -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).
11 changes: 10 additions & 1 deletion plugins/modules/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,15 @@ def update_lxc_instance(self, vmid, node, **kwargs):
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."
)
russoz marked this conversation as resolved.
Show resolved Hide resolved

# fetch current config
proxmox_node = self.proxmox_api.nodes(node)
current_config = getattr(proxmox_node, self.VZ_TYPE)(vmid).config.get()
Expand Down Expand Up @@ -1215,7 +1224,7 @@ def create_lxc_instance(self, vmid, node, ostemplate, timeout, **kwargs):
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."
Expand Down