fix: refresh recreated OCI edge host keys
This commit is contained in:
parent
a82a65c02c
commit
9f3c3fe479
|
|
@ -7976,6 +7976,7 @@ edge_apply() {
|
|||
export TF_VAR_edge_ssh_key_path="${configured_edge_key}"
|
||||
fi
|
||||
refresh_oci_edge_endpoint
|
||||
refresh_oci_edge_host_key
|
||||
|
||||
run_tofu_stack "bootstrap/edge"
|
||||
local edge_host="${TF_VAR_edge_host:-${LAB_EDGE_HOST:-}}"
|
||||
|
|
@ -8014,6 +8015,21 @@ refresh_oci_edge_endpoint() {
|
|||
fi
|
||||
}
|
||||
|
||||
refresh_oci_edge_host_key() {
|
||||
local edge_host="${LAB_EDGE_HOST:-${TF_VAR_edge_host:-}}"
|
||||
local known_hosts="${HOME}/.ssh/known_hosts"
|
||||
|
||||
# OCI instances may be destroyed and recreated with the same public IP.
|
||||
# Remove only the managed OCI edge address so accept-new can record the
|
||||
# replacement fingerprint; unrelated homelab host keys remain untouched.
|
||||
if [[ -z "${edge_host}" || "${LAB_OCI_FOUNDATION_ENABLED:-false}" != "true" ]]; then
|
||||
return 0
|
||||
fi
|
||||
if [[ -f "${known_hosts}" ]] && command -v ssh-keygen >/dev/null 2>&1; then
|
||||
ssh-keygen -R "${edge_host}" -f "${known_hosts}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
|
||||
edge_flush_caches() {
|
||||
local edge_host="${TF_VAR_edge_host:-${LAB_EDGE_HOST:-}}"
|
||||
local edge_user="${TF_VAR_edge_user:-${LAB_EDGE_USER:-ubuntu}}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue