From 89ac4558a00d3dcf01eb2f2c7f191bda5889535e Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 30 Sep 2026 13:04:54 -0300 Subject: [PATCH] fix(xcat-core): the baseline error names the service node and a log path together check_provisioning_source.sh --baseline wrote one message for two conditions: "no access log to baseline on ${MN_BASE:+$SN}${MN_BASE:-$MN}". When the management node has a log and the service node does not, the second expansion returns the management node's baseline spec, not a host name. On xcat42 the message read "no access log to baseline on nosuchnode-xyz/var/log/httpd/access_log:881". That is the message an operator reads when xdsh cannot reach the service node, so it has to name the host that has no log. Each condition now has its own test and its own message. check_provisioning_source.bats covers the service-node condition. The case also asserts the management node's log path is absent from the message, because the node name alone matches the old text as a substring. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- .../commoncmd/check_provisioning_source.sh | 8 ++++++-- xCAT-test/bats/check_provisioning_source.bats | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh b/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh index ea18505a7..1f4883d6a 100755 --- a/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh +++ b/xCAT-test/autotest/testcase/commoncmd/check_provisioning_source.sh @@ -160,8 +160,12 @@ MN=$(hostname) if [ "$MODE" = baseline ]; then MN_BASE=$(baseline_local | read_baseline) SN_BASE=$(xdsh "$SN" -e "$SELF" --baseline-local 2>&1 | read_baseline) - if [ -z "$MN_BASE" ] || [ -z "$SN_BASE" ]; then - echo "provisioning source error: no access log to baseline on ${MN_BASE:+$SN}${MN_BASE:-$MN}" >&2 + if [ -z "$MN_BASE" ]; then + echo "provisioning source error: no access log to baseline on $MN" >&2 + exit 1 + fi + if [ -z "$SN_BASE" ]; then + echo "provisioning source error: no access log to baseline on $SN" >&2 exit 1 fi printf 'MN %s\nSN %s\n' "$MN_BASE" "$SN_BASE" >"$STATE" || exit 1 diff --git a/xCAT-test/bats/check_provisioning_source.bats b/xCAT-test/bats/check_provisioning_source.bats index 4f05322ce..6a1d78637 100644 --- a/xCAT-test/bats/check_provisioning_source.bats +++ b/xCAT-test/bats/check_provisioning_source.bats @@ -251,3 +251,18 @@ seed_logs() [ "$status" -ne 0 ] [[ "$output" == *"has no address"* ]] } + +@test "a baseline that cannot reach the service node names the service node" { + seed_logs + printf '#!/bin/sh\nexit 1\n' >"$BIN/xdsh" + chmod 0755 "$BIN/xdsh" + + run env XCAT_HTTPD_ACCESS_LOG="$MN_LOG" XCAT_PROV_SOURCE_STATE="$STATE" \ + "$SCRIPT" --baseline "$CN" "$SN" + [ "$status" -ne 0 ] + [[ "$output" == *"no access log to baseline on $SN"* ]] + # The message used to append the management node's baseline spec after the node name, so a + # substring match on the name alone passes either way. + [[ "$output" != *"$MN_LOG"* ]] + [ ! -e "$STATE" ] +}