Skip to content

Commit d1c11e3

Browse files
fonta-rhclaude
andcommitted
fix: make doctor read-only and add assisted.yml check
Doctor sources common.sh which unconditionally runs sync_config_files, writing to the working tree. Add SKIP_CONFIG_SYNC guard so doctor honours its read-only contract. Also add a missing assisted installer config section so `make doctor fencing-assisted` validates vars/assisted.yml. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 023e121 commit d1c11e3

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

deploy/common.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ function sync_config_files() {
6363
done
6464
done
6565
}
66-
sync_config_files
66+
if [[ "${SKIP_CONFIG_SYNC:-0}" != "1" ]]; then
67+
sync_config_files
68+
fi
6769

6870
if [[ -f "${COMMON_DIR}/aws-hypervisor/instance.env" ]]; then
6971
# shellcheck source=/dev/null

deploy/openshift-clusters/scripts/doctor.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ INSTANCE_ENV="${DEPLOY_DIR}/aws-hypervisor/instance.env"
2222
# common.sh provides the color constants, msg_* helpers, and env defaults, but
2323
# unconditionally sources instance.env; silence that noise when instance.env
2424
# does not exist yet (its absence is reported as a proper check below).
25+
# SKIP_CONFIG_SYNC: doctor is read-only — suppress the automatic config sync.
26+
export SKIP_CONFIG_SYNC=1
2527
if [[ -f "${INSTANCE_ENV}" ]]; then
2628
# shellcheck source=/dev/null
2729
source "${DEPLOY_DIR}/common.sh"
@@ -87,6 +89,7 @@ usage() {
8789
TARGETED=0
8890
NEED_DEVSCRIPTS=0
8991
NEED_KCLI=0
92+
NEED_ASSISTED=0
9093
REQUIRED_TOPOLOGIES=" "
9194

9295
for arg in "$@"; do
@@ -99,6 +102,7 @@ for arg in "$@"; do
99102
# assisted deploys the hub via fencing-ipi, so it needs the dev-scripts config
100103
TARGETED=1
101104
NEED_DEVSCRIPTS=1
105+
NEED_ASSISTED=1
102106
REQUIRED_TOPOLOGIES+="fencing "
103107
;;
104108
arbiter-ipi|arbiter-agent|fencing-ipi|fencing-agent|sno-ipi|sno-agent)
@@ -378,6 +382,29 @@ else
378382
fi
379383
fi
380384

385+
# --- assisted installer configuration ---
386+
387+
section "assisted installer configuration"
388+
389+
ASSISTED_VARS="${DEPLOY_DIR}/openshift-clusters/vars/assisted.yml"
390+
391+
if [[ "${NEED_ASSISTED}" -eq 0 && ! -f "${ASSISTED_VARS}" ]]; then
392+
check_note "section skipped: no assisted config detected (vars/assisted.yml) - only needed for fencing-assisted deployments"
393+
else
394+
if [[ -f "${ASSISTED_VARS}" ]]; then
395+
check_pass "vars/assisted.yml present"
396+
SPOKE_NAME="$(sed -nE 's/^spoke_cluster_name:[[:space:]]*"?([^"]+)"?.*/\1/p' "${ASSISTED_VARS}" | head -1)"
397+
if [[ -n "${SPOKE_NAME}" ]]; then
398+
check_pass "spoke_cluster_name set to '${SPOKE_NAME}'"
399+
else
400+
check_warn "spoke_cluster_name not set in vars/assisted.yml (defaults to 'spoke-tnf')"
401+
fi
402+
elif [[ "${NEED_ASSISTED}" -eq 1 ]]; then
403+
check_fail "vars/assisted.yml missing (required for fencing-assisted deployment)" \
404+
"cp ${CONFIG_DIR}/assisted.yml.template ${CONFIG_DIR}/assisted.yml and edit it"
405+
fi
406+
fi
407+
381408
# --- Summary ---
382409

383410
echo ""

0 commit comments

Comments
 (0)