Harden OCI tenancy discovery from profile
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 21:10:01 -06:00
parent 10ef95c3eb
commit a2de0a6b3b
1 changed files with 17 additions and 1 deletions

View File

@ -8060,8 +8060,24 @@ refresh_oci_edge_endpoint() {
tenancy_id="$(awk -v profile="[${OCI_CLI_PROFILE:-DEFAULT}]" '
$0 == profile { in_profile=1; next }
/^\[/ { in_profile=0 }
in_profile && $1 ~ /^tenancy=/ { sub(/^tenancy=/, "", $0); print $0; exit }
in_profile && $0 ~ /^[[:space:]]*tenancy[[:space:]]*=/ {
sub(/^[[:space:]]*tenancy[[:space:]]*=[[:space:]]*/, "", $0)
print $0
exit
}
' "${oci_config_file}" 2>/dev/null || true)"
# OCI profile names are case-sensitive in the file but operators may
# export a differently-cased OCI_CLI_PROFILE. If the selected section
# was not found, use the first tenancy entry as a safe fallback.
if [[ -z "${tenancy_id}" ]]; then
tenancy_id="$(awk '
/^[[:space:]]*tenancy[[:space:]]*=/ {
sub(/^[[:space:]]*tenancy[[:space:]]*=[[:space:]]*/, "", $0)
print $0
exit
}
' "${oci_config_file}" 2>/dev/null || true)"
fi
fi
# Existing-instance mode can retain an old/null public_ip in state. Query