From 9442b44dfd85e49733ca303629e7fa45809f8b27 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 9 Feb 2017 15:52:35 +0800 Subject: [PATCH] fix issue [DEV] "updatenode -P" will complain "msgutil_r: command not found" if no "/xcatpost" on #2473 --- xCAT/postscripts/xcatdsklspost | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 28d9a3838..3e2c4ffb1 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -53,6 +53,15 @@ echolog() { local msgtype=$1 local msgstr=$2 + local ismsgutil_r=1 + + #if msgutil_r is not defined, when no /xcatpost directory exists on the node running this script + #write the message to local log file as a simplified function + type -t msgutil_r >/dev/null || ismsgutil_r=0 + [ "$ismsgutil_r" = "0" ] && msgutil_r () { + echo "$(date) [$2]: $3" >> $4 + } + if [ "$msgtype" = "debug" ];then if [ "$VERBOSE" = "1" ]; then @@ -66,6 +75,11 @@ echolog() msgutil_r "$MASTER_IP" "$msgtype" "$msgstr" "/var/log/xcat/xcat.log" fi + #reload the functions defined in./xcatlib.sh + if [ "$ismsgutil_r" = "0" ];then + unset msgutil_r + [ -f ./xcatlib.sh ] && source ./xcatlib.sh + fi }