Add timeout on wait_for_lxc_ip
This commit is contained in:
parent
b18899c25c
commit
893f8d4f61
|
@ -30,16 +30,22 @@ if ! lxc list --format csv | grep -q "$LXC_INSTANCE_NAME"; then
|
|||
fi
|
||||
|
||||
IP_V4_ADDRESS=
|
||||
COUNTER=0
|
||||
while true; do
|
||||
if [ "$COUNTER" -gt 50 ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
IP_V4_ADDRESS="$(lxc list "$LXC_INSTANCE_NAME" --format csv --columns=4 | grep enp5s0 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" || true
|
||||
export IP_V4_ADDRESS="$IP_V4_ADDRESS"
|
||||
if [ -n "$IP_V4_ADDRESS" ]; then
|
||||
# give the machine extra time to spin up.
|
||||
wait-for-it -t 300 "$IP_V4_ADDRESS:22"
|
||||
wait-for-it -t 120 "$IP_V4_ADDRESS:22"
|
||||
break
|
||||
else
|
||||
sleep 1
|
||||
printf '.'
|
||||
COUNTER=$((COUNTER + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in New Issue