Search OCI compartments during edge recovery
This commit is contained in:
parent
285e8cad3f
commit
8d1605c4cd
|
|
@ -8103,7 +8103,20 @@ refresh_oci_edge_endpoint() {
|
|||
declare -F oci_cli_resolve >/dev/null 2>&1; then
|
||||
oci_bin="${oci_bin:-$(oci_cli_resolve 2>/dev/null || true)}"
|
||||
if [[ -n "${oci_bin}" ]]; then
|
||||
local -a edge_compartments=("${instance_compartment}" "${LAB_OCI_TENANCY_ID:-}")
|
||||
local -a edge_compartments=("${instance_compartment}")
|
||||
# The instance may have been recreated in a child compartment
|
||||
# after the original state was removed. Enumerate the tenancy's
|
||||
# compartments so recovery does not depend on the old compartment
|
||||
# OCID being correct.
|
||||
if [[ -n "${LAB_OCI_TENANCY_ID:-}" ]]; then
|
||||
while IFS= read -r candidate_compartment; do
|
||||
[[ -n "${candidate_compartment}" ]] && edge_compartments+=("${candidate_compartment}")
|
||||
done < <("${oci_bin}" iam compartment list \
|
||||
--compartment-id "${LAB_OCI_TENANCY_ID}" \
|
||||
--compartment-id-in-subtree true --all \
|
||||
--query 'data[].id' --raw-output 2>/dev/null || true)
|
||||
edge_compartments+=("${LAB_OCI_TENANCY_ID}")
|
||||
fi
|
||||
for candidate_compartment in "${edge_compartments[@]}"; do
|
||||
[[ -n "${candidate_compartment}" ]] || continue
|
||||
candidate_id="$("${oci_bin}" compute instance list \
|
||||
|
|
|
|||
Loading…
Reference in New Issue