From 285e8cad3f63b9f8eeca3bee64ab68a921bb9557 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Wed, 28 Oct 2026 20:59:34 -0600 Subject: [PATCH] Clear stale edge IDs before OCI recovery --- lib/jeannie/pipeline.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 2c588c1..e8952fc 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -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}"