Refine output, flesh out xcat-cmdline
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10438 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
72407f52f6
commit
f54ff4ccd4
@ -7,20 +7,24 @@ echo "<xcatrequest>
|
||||
<callback_port>300</callback_port>
|
||||
</xcatrequest>" > /tmp/destreq.xml
|
||||
rm /tmp/destreq.xml
|
||||
while [ ! -f /tmp/destreq.xml ] || grep error /tmp/ipmicfg.xml; do
|
||||
while [ ! -f /tmp/destreq.xml ] || grep error /tmp/destiny.xml; do
|
||||
if [ -f /tmp/destreq.xml ]; then
|
||||
echo -n "Retrying in 60 seconds...";
|
||||
timer=60
|
||||
while [ $timer -gt 0 ]; do
|
||||
echo -en "Retrying in $timer seconds \r"
|
||||
sleep 1
|
||||
echo -n .
|
||||
timer=$(($timer-1));
|
||||
done
|
||||
fi
|
||||
echo -en " \r";
|
||||
if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available
|
||||
cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/ipmicfg.xml
|
||||
cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml
|
||||
else
|
||||
cat /tmp/destreq.xml | openssl s_client -connect $XCATDEST -quiet 2> /dev/null > /tmp/ipmicfg.xml
|
||||
cat /tmp/destreq.xml | openssl s_client -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml
|
||||
fi
|
||||
done
|
||||
rm /tmp/destreq.xml
|
||||
DESTINY=`grep destiny /tmp/destiny.xml | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
|
||||
rm /tmp/destiny.xml
|
||||
echo $DESTINY
|
||||
|
||||
|
@ -20,14 +20,15 @@ echo "<xcatrequest>
|
||||
rm /tmp/ipmicfg.xml
|
||||
while [ ! -f /tmp/ipmicfg.xml ] || grep error /tmp/ipmicfg.xml; do
|
||||
if [ -f /tmp/ipmicfg.xml ]; then
|
||||
echo -n "Retrying in 60 seconds...";
|
||||
timer=60
|
||||
while [ $timer -gt 0 ]; do
|
||||
sleep 1
|
||||
echo -n .
|
||||
echo -en "Retrying in $timer seconds \r"
|
||||
timer=$(($timer-1));
|
||||
done
|
||||
fi
|
||||
echo -en " \r";
|
||||
|
||||
if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available
|
||||
cat /tmp/bmcreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/ipmicfg.xml
|
||||
else
|
||||
|
@ -7,20 +7,23 @@ echo "<xcatrequest>
|
||||
<callback_port>300</callback_port>
|
||||
</xcatrequest>" > /tmp/destreq.xml
|
||||
rm /tmp/destreq.xml
|
||||
while [ ! -f /tmp/destreq.xml ] || grep error /tmp/ipmicfg.xml; do
|
||||
while [ ! -f /tmp/destreq.xml ] || grep error /tmp/destiny.xml; do
|
||||
if [ -f /tmp/destreq.xml ]; then
|
||||
echo -n "Retrying in 60 seconds...";
|
||||
timer=60
|
||||
while [ $timer -gt 0 ]; do
|
||||
echo -en "Retrying in $timer seconds \r"
|
||||
sleep 1
|
||||
echo -n .
|
||||
timer=$(($timer-1));
|
||||
done
|
||||
fi
|
||||
echo -en " \r";
|
||||
if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available
|
||||
cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/ipmicfg.xml
|
||||
cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml
|
||||
else
|
||||
cat /tmp/destreq.xml | openssl s_client -connect $XCATDEST -quiet 2> /dev/null > /tmp/ipmicfg.xml
|
||||
cat /tmp/destreq.xml | openssl s_client -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml
|
||||
fi
|
||||
done
|
||||
rm /tmp/destreq.xml
|
||||
DESTINY=`grep destiny /tmp/destiny.xml | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
|
||||
rm /tmp/destiny.xml
|
||||
echo $DESTINY
|
||||
|
@ -115,8 +115,47 @@ for parm in `cat /proc/cmdline`; do
|
||||
XCATPORT=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $2}'`
|
||||
fi
|
||||
done
|
||||
if [ "$destiny" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do
|
||||
/bin/dodiscovery
|
||||
if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can and should get a cert
|
||||
/bin/getcert $XCATMASTER:$XCATPORT
|
||||
fi
|
||||
/bin/getcert $XCATMASTER:$XCATPORT
|
||||
/bin/sh
|
||||
while :; do
|
||||
if [ -z "$destiny" ]; then
|
||||
destiny=`getdestiny`
|
||||
fi
|
||||
destparameter=`echo $destiny|awk -F= '{print $2}'`
|
||||
destiny=`echo $destiny|awk -F= '{print $1}'`
|
||||
if [ "$destiny" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do
|
||||
/bin/dodiscovery
|
||||
/bin/getcert $XCATMASTER:$XCATPORT
|
||||
destiny=''
|
||||
elif [ "$destiny" = shell ]; then
|
||||
echo "Dropping to debug shell, exit to check for further action"
|
||||
destiny=''
|
||||
/bin/sh
|
||||
elif [ "$destiny" = runcmd ]; then
|
||||
destiny=''
|
||||
$destparameter
|
||||
elif [ "$destiny" = "reboot" -o "$destiny" = "boot" ]; then
|
||||
/bin/nextdestiny
|
||||
reboot -f
|
||||
elif [ "$destiny" = standby ]; then
|
||||
destiny=''
|
||||
delay=$((30+$RANDOM%270))
|
||||
while [ $delay -gt 0 ]; do
|
||||
echo -en "Received request to retry in a bit, will call xCAT back in $delay seconds \r"
|
||||
delay=$((delay-1))
|
||||
sleep 1
|
||||
done
|
||||
echo "Retrying ";
|
||||
else
|
||||
echo "Unrecognized directive $destiny"
|
||||
destiny=''
|
||||
delay=$((30+$RANDOM%270))
|
||||
while [ $delay -gt 0 ]; do
|
||||
echo -en "Will retry in $delay seconds \r"
|
||||
delay=$((delay-1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user