From 9a0aea8f89ae59509f499c9570e3c63729a480ec Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Sat, 25 Jul 2026 16:25:06 +1000 Subject: [PATCH] fix(create-proxmox-resource): auto-generate missing host key before sync If host-keys/_ssh_host_ed25519_key doesn't exist, run prepare-host-key.sh to generate it before sync-host-keys.sh runs. Prevents sync-host-keys.sh from hitting its SKIP/exit-1 path (anchor in .sops.yaml but no local key) and the downstream disko build failure when --pre-format-files can't find the key file. Co-Authored-By: Claude Sonnet 4.6 --- scripts/proxmox/create-proxmox-resource.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/proxmox/create-proxmox-resource.sh b/scripts/proxmox/create-proxmox-resource.sh index fd4f3a0..515f3aa 100755 --- a/scripts/proxmox/create-proxmox-resource.sh +++ b/scripts/proxmox/create-proxmox-resource.sh @@ -487,6 +487,17 @@ nix_extra_opts # --- make sure this target has a registered host key -------------------- echo echo "==> Ensuring host key exists and is registered..." +_host_keyfile="${repo_root}/host-keys/${flake_target}_ssh_host_ed25519_key" +if [[ ! -f "$_host_keyfile" ]]; then + echo " No host key found for ${flake_target}; generating one via prepare-host-key.sh..." + _prepare_host_key="${repo_root}/scripts/secrets/prepare-host-key.sh" + if [[ "$dry_run" -eq 1 ]]; then + echo "[dry-run] would run: bash ${_prepare_host_key} ${flake_target}" + else + bash "$_prepare_host_key" "$flake_target" + fi +fi +unset _host_keyfile _prepare_host_key sync_args=("$flake_target") [[ "$dry_run" -eq 1 ]] && sync_args+=(--dry-run) bash "$sync_keys" "${sync_args[@]}"