2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 10:06:39 +00:00

Merge pull request #2728 from immarvin/onissue

fix issue postscript fails and status=booted. #2665
This commit is contained in:
cxhong 2017-03-23 10:37:25 -04:00 committed by GitHub
commit 406e0f6842
2 changed files with 19 additions and 0 deletions

View File

@ -180,6 +180,7 @@ echo "
# global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed
return_value=0
# subroutine used to run postscripts
# \$1 argument is the script type
# rest argument is the script name and arguments
@ -227,6 +228,7 @@ run_ps () {
return_value=-1
fi
return 0
}
# subroutine end
@ -389,6 +391,19 @@ fi
#create the preboot script and run here
TMP=`sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ d" /xcatpost/mypostscript`
echo "$TMP" > /xcatpost/mypostscript
echo "
#save bad return code to /opt/xcat/xcatinfo
if [ \"\$return_value\" -ne \"0\" ]; then
grep 'POSTSCRIPTS_RC' /opt/xcat/xcatinfo > /dev/null 2>&1
if [ \$? -eq 0 ]; then
sed -i \"s/POSTSCRIPTS_RC=.*/POSTSCRIPTS_RC=1/\" /opt/xcat/xcatinfo
else
echo \"POSTSCRIPTS_RC=1\" >> /opt/xcat/xcatinfo
fi
fi
" >> /xcatpost/mypostscript
chmod 755 /xcatpost/mypostscript
export ARCH=#TABLE:nodetype:THISNODE:arch#

View File

@ -84,6 +84,9 @@ if [ -z "$CNS" ] || [[ "$CNS" =~ ^(1|yes|y)$ ]]; then
echo "
[ -f /opt/xcat/xcatinfo ] && grep 'POSTSCRIPTS_RC=1' /opt/xcat/xcatinfo >/dev/null 2>&1 && return_value=1
if [ \"\$return_value\" -eq \"0\" ]; then
if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then
msgutil_r \"\$MASTER_IP\" \"info\" \"node booted, reporting status...\" \"/var/log/xcat/xcat.log\"
@ -99,6 +102,7 @@ fi
" >> /xcatpost/mypostscript.post
fi
chmod +x /xcatpost/mypostscript.post
if [ -x /xcatpost/mypostscript.post ];then
msgutil_r "$MASTER_IP" "info" "running /xcatpost/mypostscript.post" "/var/log/xcat/xcat.log"