defect 3289489: fixed the issue that the awk file hang when no entry in the policy table

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9412 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
daniceexi 2011-04-27 08:53:38 +00:00
parent c34f2d22f9
commit 7f87595450
2 changed files with 21 additions and 9 deletions

View File

@ -15,11 +15,14 @@ BEGIN {
print " <arg>"ARGV[i]"</arg>" |& server
print "</xcatrequest>" |& server
start = 0
while (server |& getline) {
if (match($0,/^\s*</)) {
if (match($0,"<xcatresponse>")) {
start = 1
}
if (start == 1) {
print $0
}
print $0
if (match($0,"<serverdone>")) {
quit = "yes"
}

View File

@ -15,14 +15,23 @@ export USEOPENSSLFORXCAT
sleep 1
mkdir -p /root/.xcat
chmod 700 /root/.xcat
getcredentials.awk xcat_client_cred | grep -v '<'|sed -e 's/&lt;/</' -e 's/&gt;/>/' -e 's/&amp;/&/' -e 's/&quot/"/' -e "s/&apos;/'/" > /root/.xcat/client-cred.pem
CONT=`cat /root/.xcat/client-cred.pem`
while [ -z "$CONT" ]; do
let SLI=$RANDOM%10+10
sleep $SLI
getcredentials.awk xcat_client_cred | grep -v '<'|sed -e 's/&lt;/</' -e 's/&gt;/>/' -e 's/&amp;/&/' -e 's/&quot/"/' -e "s/&apos;/'/" > /root/.xcat/client-cred.pem
getcredentials.awk xcat_client_cred > /tmp/xcat_client_cred
grep -E '<error>' /tmp/xcat_client_cred
if [ $? -ne 0 ]; then
cat /tmp/xcat_client_cred | grep -v '<'|sed -e 's/&lt;/</' -e 's/&gt;/>/' -e 's/&amp;/&/' -e 's/&quot/"/' -e "s/&apos;/'/" > /root/.xcat/client-cred.pem
CONT=`cat /root/.xcat/client-cred.pem`
done
while [ -z "$CONT" ]; do
let SLI=$RANDOM%10+10
sleep $SLI
getcredentials.awk xcat_client_cred | grep -v '<'|sed -e 's/&lt;/</' -e 's/&gt;/>/' -e 's/&amp;/&/' -e 's/&quot/"/' -e "s/&apos;/'/" > /root/.xcat/client-cred.pem
CONT=`cat /root/.xcat/client-cred.pem`
done
else
ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/xcat_client_cred`
logger -t xCAT xcat_client_cred Error: $ERR_MSG
fi
rm /tmp/xcat_client_cred
chmod 600 /root/.xcat/client-cred.pem
cp _xcat/ca.pem /root/.xcat/ca.pem
kill -9 $CREDPID