mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-23 19:02:17 +00:00
fix(install): an IPv6-only node halts in %post downloading its postscripts
post.xcat and post.xcat.ng built their download URLs as "http://$MASTER_IP:${HTTPPORT}...". An IPv6 management node address already contains colons, so the result is not a URL, curl and wget refuse it, the script reports installstatus failed and halts with sleep infinity. The install itself has already succeeded at that point, so the node sits in %post and xCAT records status=failed, which reads as an install failure. Measured on openEuler 24.03: the node took its reserved address, installed all 565 packages over IPv6, then stopped in "Running post-installation scripts". Both scripts now carry the format_uri_host helper that post.xcat.rhels10 already had, and build their URLs from MASTER_HTTP_HOST. The helper is a third copy because a node has no shared shell library at the point these scripts run. This reaches openEuler, EL 8, EL 9 and CentOS 8 through post.xcat.ng, and the Ubuntu and SUSE post scripts through post.xcat. EL 10 was already correct. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,20 @@ export HTTPPORT="#TABLEBLANKOKAY:site:key=httpport:value#"
|
||||
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/scriptlib#
|
||||
|
||||
# An IPv6 management node address already contains colons, so it has to be bracketed
|
||||
# before it goes in a URL. The same helper is in post.xcat.rhels10: a node has no shared
|
||||
# shell library at the point this script runs.
|
||||
format_uri_host()
|
||||
{
|
||||
case "$1" in
|
||||
\[*\]) printf '%s' "$1" ;;
|
||||
*:*) printf '[%s]' "$1" ;;
|
||||
*) printf '%s' "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
MASTER_HTTP_HOST="$(format_uri_host "$MASTER_IP")"
|
||||
|
||||
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
|
||||
set -x
|
||||
fi
|
||||
@@ -100,9 +114,9 @@ if [ ! -x /usr/bin/wget ]; then
|
||||
sleep 36500d
|
||||
fi
|
||||
|
||||
xcat_download_postscripts "${MASTER_IP}:${HTTPPORT}" "$INSTALLDIR" "/xcatpost" "/tmp/wget.log"
|
||||
xcat_download_postscripts "${MASTER_HTTP_HOST}:${HTTPPORT}" "$INSTALLDIR" "/xcatpost" "/tmp/wget.log"
|
||||
if [ "$?" != "0" ]; then
|
||||
msgutil_r "$MASTER_IP" "error" "failed to download postscripts from http://$MASTER_IP$INSTALLDIR/postscripts/,check /tmp/wget.log on the node, halt ..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
msgutil_r "$MASTER_IP" "error" "failed to download postscripts from http://${MASTER_HTTP_HOST}:${HTTPPORT}$INSTALLDIR/postscripts/,check /tmp/wget.log on the node, halt ..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
sleep 36500d
|
||||
fi
|
||||
@@ -117,7 +131,7 @@ export NODE=#TABLE:nodelist:THISNODE:node#
|
||||
|
||||
msgutil_r "$MASTER_IP" "info" "trying to get mypostscript from $MASTER_IP..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
|
||||
wget -N --waitretry=10 --random-wait --retry-connrefused -t 20 -T 60 http://${MASTER_IP}:${HTTPPORT}${TFTPDIR}/mypostscripts/mypostscript.$NODE -P /xcatpost 2> /tmp/wget.log
|
||||
wget -N --waitretry=10 --random-wait --retry-connrefused -t 20 -T 60 "http://${MASTER_HTTP_HOST}:${HTTPPORT}${TFTPDIR}/mypostscripts/mypostscript.$NODE" -P /xcatpost 2> /tmp/wget.log
|
||||
if [ "$?" = "0" ]; then
|
||||
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "precreated mypostscript downloaded successfully" "/var/log/xcat/xcat.log" "$log_label"
|
||||
|
||||
@@ -13,6 +13,20 @@ export HTTPPORT="#TABLEBLANKOKAY:site:key=httpport:value#"
|
||||
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/scriptlib#
|
||||
|
||||
# An IPv6 management node address already contains colons, so it has to be bracketed
|
||||
# before it goes in a URL. The same helper is in post.xcat.rhels10: a node has no shared
|
||||
# shell library at the point this script runs.
|
||||
format_uri_host()
|
||||
{
|
||||
case "$1" in
|
||||
\[*\]) printf '%s' "$1" ;;
|
||||
*:*) printf '[%s]' "$1" ;;
|
||||
*) printf '%s' "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
MASTER_HTTP_HOST="$(format_uri_host "$MASTER_IP")"
|
||||
|
||||
umask 0022
|
||||
|
||||
case "$XCATDEBUGMODE" in
|
||||
@@ -139,10 +153,10 @@ function download_recursive()
|
||||
return 0
|
||||
}
|
||||
|
||||
download_recursive "http://$MASTER_IP:${HTTPPORT}$INSTALLDIR/postscripts/" "/xcatpost" 2>/tmp/download.log
|
||||
download_recursive "http://${MASTER_HTTP_HOST}:${HTTPPORT}$INSTALLDIR/postscripts/" "/xcatpost" 2>/tmp/download.log
|
||||
if [ "$?" -ne "0" ]
|
||||
then
|
||||
msgutil_r "$MASTER_IP" "error" "failed to download postscripts from http://$MASTER_IP$INSTALLDIR/postscripts/, check /tmp/download.log on the node, halt ..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
msgutil_r "$MASTER_IP" "error" "failed to download postscripts from http://${MASTER_HTTP_HOST}:${HTTPPORT}$INSTALLDIR/postscripts/, check /tmp/download.log on the node, halt ..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
/tmp/updateflag "$MASTER_IP" "$XCATIPORT" "installstatus failed"
|
||||
sleep infinity
|
||||
fi
|
||||
@@ -158,7 +172,7 @@ export NODE="#TABLE:nodelist:THISNODE:node#"
|
||||
|
||||
msgutil_r "$MASTER_IP" "info" "trying to get mypostscript from $MASTER_IP..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
|
||||
curl --fail --retry 20 --max-time 60 "http://$MASTER_IP:${HTTPPORT}$TFTPDIR/mypostscripts/mypostscript.$NODE" -o "/xcatpost/mypostscript.$NODE" 2> /tmp/download.log
|
||||
curl --fail --retry 20 --max-time 60 "http://${MASTER_HTTP_HOST}:${HTTPPORT}$TFTPDIR/mypostscripts/mypostscript.$NODE" -o "/xcatpost/mypostscript.$NODE" 2> /tmp/download.log
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
case "$XCATDEBUGMODE" in
|
||||
|
||||
Reference in New Issue
Block a user