2
0
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:
Vinícius Ferrão
2026-08-30 23:37:44 -03:00
parent a5ad2f7b26
commit 3d5a1b7dd8
2 changed files with 19 additions and 7 deletions
+3 -7
View File
@@ -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/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' -e 's/&quot;/"/g' -e "s/&apos;/'/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/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' -e 's/&quot;/"/g' -e "s/&apos;/'/g" > /$xcatpost/mypostscript;
MYCONT=`grep MASTER /$xcatpost/mypostscript`
MYCONT=`fetch_mypostscript "$xcatpost" $GETPOSTSCRIPT_ARGS`
if [ ! -z "$MYCONT" ]; then
break;
fi
+16
View File
@@ -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/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' \
-e 's/&quot;/"/g' -e "s/&apos;/'/g" > /$postroot/mypostscript
grep MASTER /$postroot/mypostscript
}