Add a 60 seconds timeout to ping_metadata_ip()
Change-Id: I1e476093a16848a4fd702eb8efacc420b6c2255a Closes-Bug: #1735849
This commit is contained in:
parent
25741d4fd9
commit
ea4e582567
@ -38,6 +38,7 @@ function is_local_ip() {
|
||||
|
||||
function ping_metadata_ip() {
|
||||
local METADATA_IP=$(get_metadata_ip)
|
||||
local METADATA_IP_PING_TIMEOUT=60
|
||||
|
||||
if [ -n "$METADATA_IP" ] && ! is_local_ip $METADATA_IP; then
|
||||
|
||||
@ -46,7 +47,8 @@ function ping_metadata_ip() {
|
||||
local COUNT=0
|
||||
until ping -c 1 $METADATA_IP &> /dev/null; do
|
||||
COUNT=$(( $COUNT + 1 ))
|
||||
if [ $COUNT -eq 10 ]; then
|
||||
sleep 1
|
||||
if [ $COUNT -eq $METADATA_IP_PING_TIMEOUT ]; then
|
||||
echo "FAILURE"
|
||||
echo "$METADATA_IP is not pingable." >&2
|
||||
exit 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user