fix: deduplicate SSH keys on LXC/VM create; filter qemu templates in wizard
Some checks failed
Backend Tests / pytest (Python 3.12) (push) Has been cancelled

This commit is contained in:
markmorado
2026-05-08 13:06:23 +02:00
parent 5cb186e8d1
commit c317c4d81a
3 changed files with 29 additions and 2 deletions

View File

@@ -2358,6 +2358,15 @@ async def create_lxc_container(
combined_ssh_keys = f"{combined_ssh_keys}\n{current_user.ssh_public_key}"
else:
combined_ssh_keys = current_user.ssh_public_key
# Deduplicate SSH keys while preserving order
_seen_ssh: set = set()
_uniq_ssh = []
for _k in combined_ssh_keys.splitlines():
_k = _k.strip()
if _k and _k not in _seen_ssh:
_seen_ssh.add(_k)
_uniq_ssh.append(_k)
combined_ssh_keys = "\n".join(_uniq_ssh)
upid = client.create_lxc_container(
node=node,
@@ -2492,6 +2501,15 @@ async def create_lxc_container_smart(
combined_ssh_keys = f"{combined_ssh_keys}\n{current_user.ssh_public_key}"
else:
combined_ssh_keys = current_user.ssh_public_key
# Deduplicate SSH keys while preserving order
_seen_ssh: set = set()
_uniq_ssh = []
for _k in combined_ssh_keys.splitlines():
_k = _k.strip()
if _k and _k not in _seen_ssh:
_seen_ssh.add(_k)
_uniq_ssh.append(_k)
combined_ssh_keys = "\n".join(_uniq_ssh)
# Создаём контейнер
upid = client.create_lxc_container(