2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-07-31 18:19:40 +00:00

fix(rcons): resolve a conserver hostname before the local-address check

When nodehm.conserver is a hostname, rcons compared that name directly against
the management node's local IP addresses, so the "conserver is this host"
check never matched and rcons connected via `-s` (a remote confluent session)
even when the conserver was the local host. Resolve the name to an address
with getent first so the comparison works.

Recovered from the unmerged lenovobuild branch (original faa767e5).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
This commit is contained in:
Vinícius Ferrão
2026-07-22 19:46:14 -03:00
parent cf44f51463
commit bdf8ec36db
+5
View File
@@ -115,6 +115,11 @@ if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
# nodehm.conserver may be a hostname; resolve it so the local-address
# comparison below matches when the conserver is this host.
if [ ! -z "$CONSERVER" ]; then
CONSERVER=$(getent hosts $CONSERVER | awk '{print $1}')
fi
declare -a ipaddrs=`ip -o a | awk {'print $4'} | cut -d/ -f1 | grep -v : | tr '\n' ' '`
for IP in ${ipaddrs[*]}; do
if [[ "${CONSERVER}" == "${IP}" ]]; then