Skip to content

Commit 54eea42

Browse files
fonta-rhclaude
andcommitted
fix: address review findings from PR #93
- Remove blanket 2>/dev/null when sourcing common.sh; use SKIP_INSTANCE_ENV_WARNING flag for targeted suppression - ansible-galaxy: capture stderr so config errors surface instead of cascading false "missing collection" failures - timeout exit codes ≥125: report as "could not run" not "credentials not working" - curl: include exit code in CI token check warning Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d1c11e3 commit 54eea42

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

deploy/openshift-clusters/scripts/doctor.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@ REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)"
1919
CONFIG_DIR="${REPO_ROOT}/config"
2020
INSTANCE_ENV="${DEPLOY_DIR}/aws-hypervisor/instance.env"
2121

22-
# common.sh provides the color constants, msg_* helpers, and env defaults, but
23-
# unconditionally sources instance.env; silence that noise when instance.env
24-
# does not exist yet (its absence is reported as a proper check below).
2522
# SKIP_CONFIG_SYNC: doctor is read-only — suppress the automatic config sync.
23+
# SKIP_INSTANCE_ENV_WARNING: doctor has its own instance.env section with
24+
# better guidance, so suppress the generic warning from common.sh.
2625
export SKIP_CONFIG_SYNC=1
27-
if [[ -f "${INSTANCE_ENV}" ]]; then
28-
# shellcheck source=/dev/null
29-
source "${DEPLOY_DIR}/common.sh"
30-
else
31-
# shellcheck source=/dev/null
32-
source "${DEPLOY_DIR}/common.sh" 2>/dev/null
33-
fi
26+
export SKIP_INSTANCE_ENV_WARNING=1
27+
# shellcheck source=/dev/null
28+
source "${DEPLOY_DIR}/common.sh"
3429

3530
# Strict flags only after common.sh: it expands variables that may be unset.
3631
# No 'set -e': a failing check must report and let the remaining checks run.
@@ -198,7 +193,10 @@ REQUIREMENTS_FILE="${DEPLOY_DIR}/openshift-clusters/collections/requirements.yml
198193
if ! command -v ansible-galaxy >/dev/null 2>&1; then
199194
check_warn "collection check skipped: 'ansible-galaxy' not found on PATH" "$(tool_hint ansible-playbook)"
200195
else
201-
INSTALLED_COLLECTIONS="$(ansible-galaxy collection list 2>/dev/null)"
196+
if ! INSTALLED_COLLECTIONS="$(ansible-galaxy collection list 2>&1)"; then
197+
check_warn "ansible-galaxy collection list failed; collection check unreliable" \
198+
"run 'ansible-galaxy collection list' manually to diagnose"
199+
fi
202200
MISSING_COLLECTIONS=""
203201
while read -r name; do
204202
[[ -z "${name}" ]] && continue
@@ -267,6 +265,8 @@ else
267265
check_pass "AWS credentials are live (sts get-caller-identity succeeded)"
268266
elif [[ ${AWS_RC} -eq 124 ]]; then
269267
check_warn "AWS credential check timed out after 15s" "check network/VPN connectivity and retry"
268+
elif [[ ${AWS_RC} -ge 125 ]]; then
269+
check_warn "AWS credential check could not run (exit ${AWS_RC})"
270270
else
271271
check_fail "AWS credentials not working: $(head -1 <<<"${AWS_ERR}")" \
272272
"log in again (e.g. 'aws sso login --profile ${AWS_PROFILE:-<profile>}') or check 'aws configure list'"
@@ -337,7 +337,7 @@ for topology in arbiter fencing sno; do
337337
-H "Authorization: Bearer ${CI_TOKEN}" "https://${RELEASE_REGISTRY}/v2/")"
338338
CURL_RC=$?
339339
if [[ ${CURL_RC} -ne 0 ]]; then
340-
check_warn "CI token check: could not reach ${RELEASE_REGISTRY} (network failure or timeout)"
340+
check_warn "CI token check: curl failed (exit ${CURL_RC}) reaching ${RELEASE_REGISTRY}"
341341
elif [[ "${HTTP_CODE}" == "401" ]]; then
342342
check_fail "CI token in config_${topology}.sh is invalid or expired (HTTP 401 from ${RELEASE_REGISTRY})" \
343343
"update CI_TOKEN in ${CONFIG_DIR}/config_${topology}.sh (copy a fresh token from the CI cluster console)"

0 commit comments

Comments
 (0)