Add automatic retry to devstack install script

I don't know about anyone else, but whenever I kick off the
ds-build role on a fresh VM, I see a high rate of failure with
git clone operations ("git call failed" is the error), which kills
off stack.sh and results in a failed build.  This happens about 50%
of the time for me, so I modified the devstack build script to
automatically retry if it encounters this error.

Change-Id: If91577707ed76b1ec566af9189e30bbdcd81c37d
This commit is contained in:
David Schroeder 2015-03-10 09:50:07 -06:00
parent 7a908d8a02
commit 71a4ec78fb
1 changed files with 11 additions and 2 deletions

View File

@ -39,9 +39,18 @@ su $unpriv_user -c $basedir/devstack/stack.sh 2>&1 &
# Wait for stack.sh to complete by watching the log file for $donestring
donestring='This is your host ip'
# Sometimes, 'git clone' fails, and this can be retried
retrystring='git call failed: \[git clone'
while [ `tail -1 $log 2>/dev/null |grep -c "$donestring"` = 0 ]; do
sleep 5
success=0
while [ "$success" = 0 ]; do
if [ `tail -1 $log 2>/dev/null |grep -c "$donestring"` = 1 ]; then
success=1
elif [ `tail -2 $log 2>/dev/null |grep -c "$retrystring"` = 1 ]; then
pkill -f devstack/stack.sh
su $unpriv_user -c $basedir/devstack/stack.sh 2>&1 &
fi
sleep 10
done
# Kill off the now-idle stack.sh process