From 415ed2cb768ccf55d6e05cd9347e39d7b0b1e879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sat, 25 Jul 2026 16:53:26 -0300 Subject: [PATCH] fix(xcatserver): keep the server-provided cfgloc before rewriting host= The postscript rewrites host= in the freshly fetched /etc/xcat/cfgloc to point at MASTER, discarding the database location the credentials came with. That is the only record of it when the database does not live on the management node. Keep it as cfgloc.orig; the existing chmod 600 /etc/xcat/cfgloc* covers it. Recovered from the unmerged lenovobuild branch (10090a9d). The original also replaced the atomic write with mv-then-sed, which leaves cfgloc truncated if sed fails, so the write itself is left alone. Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT/postscripts/xcatserver | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT/postscripts/xcatserver b/xCAT/postscripts/xcatserver index a277fbd2e..2b87096f2 100755 --- a/xCAT/postscripts/xcatserver +++ b/xCAT/postscripts/xcatserver @@ -169,6 +169,10 @@ if [ $? -ne 0 ]; then # if not DB2 grep "DB2" /etc/xcat/cfgloc 2>&1 1> /dev/null if [ $? -ne 0 ]; then + # keep the server-provided copy: rewriting host= to $MASTER discards the + # database location the credentials came with, which is the only record + # of it when the database does not live on the management node + cp -p /etc/xcat/cfgloc /etc/xcat/cfgloc.orig sed s/host=[^\|]*/host=$MASTER/ /etc/xcat/cfgloc > /etc/xcat/cfgloc.new mv /etc/xcat/cfgloc.new /etc/xcat/cfgloc else # DB2 cfgloc has different format