mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-04 12:07:56 +00:00
refactor(xcatdsklspost): share mypostscript fetch pipeline
This commit is contained in:
@@ -182,7 +182,6 @@ download_mypostscript()
|
||||
}
|
||||
|
||||
|
||||
|
||||
# pmatch determines if 1st argument string is matched by 2nd argument pattern
|
||||
|
||||
pmatch ()
|
||||
@@ -680,6 +679,7 @@ fi
|
||||
# We need to call getpostscript.awk .
|
||||
|
||||
if [ ! -x /$xcatpost/mypostscript ]; then
|
||||
. /$xcatpost/xcatlib.sh
|
||||
echolog "debug" "no pre-generated mypostscript.<nodename>, trying to get it with getpostscript.awk..."
|
||||
GETPOSTSCRIPT_ARGS=""
|
||||
if [ -n "$node_short" ]; then
|
||||
@@ -699,10 +699,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then
|
||||
useflowcontrol=0
|
||||
fi
|
||||
fi
|
||||
/$xcatpost/getpostscript.awk $GETPOSTSCRIPT_ARGS | egrep '<data>' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript;
|
||||
|
||||
|
||||
MYCONT=`grep MASTER /$xcatpost/mypostscript`
|
||||
MYCONT=`fetch_mypostscript "$xcatpost" $GETPOSTSCRIPT_ARGS`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
@@ -733,8 +730,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then
|
||||
useflowcontrol=0
|
||||
fi
|
||||
fi
|
||||
/$xcatpost/getpostscript.awk $GETPOSTSCRIPT_ARGS | egrep '<data>' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript;
|
||||
MYCONT=`grep MASTER /$xcatpost/mypostscript`
|
||||
MYCONT=`fetch_mypostscript "$xcatpost" $GETPOSTSCRIPT_ARGS`
|
||||
if [ ! -z "$MYCONT" ]; then
|
||||
break;
|
||||
fi
|
||||
|
||||
@@ -826,3 +826,19 @@ function msgutil_r {
|
||||
function msgutil {
|
||||
msgutil_r "" "$@"
|
||||
}
|
||||
|
||||
function fetch_mypostscript {
|
||||
local postroot
|
||||
postroot=$1
|
||||
shift
|
||||
|
||||
/$postroot/getpostscript.awk "$@" |
|
||||
egrep '<data>' |
|
||||
sed -e 's/<[^>]*>//g' |
|
||||
egrep -v '^ *$' |
|
||||
sed -e 's/^ *//' |
|
||||
sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' \
|
||||
-e 's/"/"/g' -e "s/'/'/g" > /$postroot/mypostscript
|
||||
|
||||
grep MASTER /$postroot/mypostscript
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user