Merge "Ping retry"

This commit is contained in:
Jenkins 2016-04-05 15:48:26 +00:00 committed by Gerrit Code Review
commit fa24ef5944

View File

@ -20,9 +20,12 @@ function ping_controller_ips() {
echo -n "Trying to ping $REMOTE_IP for local network $LOCAL_NETWORK..." echo -n "Trying to ping $REMOTE_IP for local network $LOCAL_NETWORK..."
set +e set +e
if ! $ping -W 300 -c 1 $REMOTE_IP &> /dev/null; then if ! $ping -W 300 -c 1 $REMOTE_IP &> /dev/null; then
echo "FAILURE" # If the first ping attempt fails, retry.
echo "$REMOTE_IP is not pingable. Local Network: $LOCAL_NETWORK" >&2 if ! $ping -W 300 -c 10 $REMOTE_IP &> /dev/null; then
exit 1 echo "FAILURE"
echo "$REMOTE_IP is not pingable. Local Network: $LOCAL_NETWORK" >&2
exit 1
fi
fi fi
set -e set -e
echo "SUCCESS" echo "SUCCESS"
@ -40,10 +43,13 @@ function ping_default_gateways() {
set +e set +e
for GW in $DEFAULT_GW; do for GW in $DEFAULT_GW; do
echo -n "Trying to ping default gateway ${GW}..." echo -n "Trying to ping default gateway ${GW}..."
if ! ping -c 1 $GW &> /dev/null; then if ! $ping -c 1 $GW &> /dev/null; then
echo "FAILURE" # If the first ping attempt fails, retry.
echo "$GW is not pingable." if ! $ping -c 10 $GW &> /dev/null; then
exit 1 echo "FAILURE"
echo "$GW is not pingable."
exit 1
fi
fi fi
done done
set -e set -e