From bdf8ec36db48ac0c027419f8cdd53fc2523d69bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:46:14 -0300 Subject: [PATCH] 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> --- xCAT-client/bin/rcons | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index 0cb077cde..488b9f5a4 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -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