2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-02 00:41:42 +00:00

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>
This commit is contained in:
Daniel Hilst
2026-09-30 13:04:54 -03:00
parent 0f708b96a6
commit 89ac4558a0
2 changed files with 21 additions and 2 deletions
@@ -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
@@ -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" ]
}