Add retries to ipmitool output

This commit is contained in:
Joshua Boniface 2024-07-29 01:04:55 -04:00
parent 7f32414675
commit a54c730662
1 changed files with 8 additions and 2 deletions

View File

@ -23,10 +23,16 @@ if [[ -z ${IPMIIP_INTERFACES} ]]; then
fi fi
# Grab IPMI IP from ipmitool # Grab IPMI IP from ipmitool
IPMIIP_IPMITOOL=""
COUNT=0
while [[ -z ${IPMIIP_IPMITOOL} && ${COUNT} -lt 3 ]]; do
IPMIIP_IPMITOOL="$( ipmitool lan print 2>/dev/null | grep 'IP Address' | grep -v 'Source' | awk '{ print $NF }' )" IPMIIP_IPMITOOL="$( ipmitool lan print 2>/dev/null | grep 'IP Address' | grep -v 'Source' | awk '{ print $NF }' )"
sleep 1
COUNT=$(( ${COUNT} + 1 ))
done
if [[ -z ${IPMIIP_IPMITOOL} ]]; then if [[ -z ${IPMIIP_IPMITOOL} ]]; then
echo "No IPMI IP returned by ipmitool" echo "No IPMI IP returned by ipmitool in 3 tries"
exit exit
fi fi
if [[ ${IPMIIP_INTERFACES} != ${IPMIIP_IPMITOOL} ]]; then if [[ ${IPMIIP_INTERFACES} != ${IPMIIP_IPMITOOL} ]]; then