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

fix(xcat-core): the provisioning-source check reads the host log beside the test one

local_logs added XCAT_HTTPD_ACCESS_LOG to the list of candidate logs and then
read the system paths as well. On a build host that runs apache, the check
counted the host's own /var/log/apache2/access.log beside the file the test
pointed at, so a test could not control what it measured. The empty-log case
read 64 lines it did not write.

An explicit XCAT_HTTPD_ACCESS_LOG now replaces the search instead of extending
it. Production behaviour is unchanged: nothing sets that variable there.

Without this change the bats case for an empty management-node log fails on a
host that serves apache, and passes on one that does not.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit bcb4a77f1a)
This commit is contained in:
Daniel Hilst
2026-09-30 13:09:38 -03:00
parent d54ee26911
commit 23e6debaad
@@ -39,8 +39,14 @@ STATE="${XCAT_PROV_SOURCE_STATE:-/var/tmp/xcat-provisioning-source.base}"
# Debian per-vhost format puts the vhost there and the client in field 2.
local_logs()
{
for f in ${XCAT_HTTPD_ACCESS_LOG:-} \
/var/log/httpd/access_log \
# An explicit log REPLACES the search. Without this a test that points here still reads the
# host's own apache log, so it cannot control what the check counts.
if [ -n "${XCAT_HTTPD_ACCESS_LOG:-}" ]; then
[ -r "$XCAT_HTTPD_ACCESS_LOG" ] && echo "$XCAT_HTTPD_ACCESS_LOG"
return 0
fi
for f in /var/log/httpd/access_log \
/var/log/apache2/access.log \
/var/log/apache2/access_log \
/var/log/apache2/other_vhosts_access.log