Clear stale edge IDs before OCI recovery
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-10-28 20:59:34 -06:00
parent 69a29ac036
commit 285e8cad3f
1 changed files with 9 additions and 1 deletions

View File

@ -8013,6 +8013,14 @@ refresh_oci_edge_endpoint() {
local candidate_id=""
local edge_identity_stale=false
# A managed edge OCID is derived from foundation state or OCI discovery;
# never let a stale value from a previous long-lived API invocation survive
# into Bastion plugin/session setup. Explicit existing-instance mode keeps
# its caller-provided identity.
if [[ -z "${LAB_OCI_EDGE_EXISTING_INSTANCE_ID:-}" ]]; then
unset LAB_OCI_EDGE_INSTANCE_ID
fi
# These are derived per run; never retain a proxy/private address from a
# previous long-lived API invocation.
unset TF_VAR_edge_ssh_host TF_VAR_edge_bastion_host TF_VAR_edge_bastion_user
@ -8100,7 +8108,7 @@ refresh_oci_edge_endpoint() {
[[ -n "${candidate_compartment}" ]] || continue
candidate_id="$("${oci_bin}" compute instance list \
--compartment-id "${candidate_compartment}" --all \
--query 'data[?"display-name"==`homelab-edge` && "freeform-tags"."managed_by"==`jeannie` && "lifecycle-state"!=`TERMINATED`].id | [0]' \
--query 'data[?"display-name"==`homelab-edge` && "lifecycle-state"!=`TERMINATED`].id | [0]' \
--raw-output 2>/dev/null || true)"
if [[ -n "${candidate_id}" && "${candidate_id}" != "null" ]]; then
discovered_edge_instance_id="${candidate_id}"