1
1
Fork 1

Add timeout on wait_for_lxc_ip

This commit is contained in:
Derek Smith 2023-10-19 22:39:12 -04:00
parent b18899c25c
commit 893f8d4f61
Signed by: farscapian
GPG Key ID: B443E530A14E1C90
1 changed files with 7 additions and 1 deletions

View File

@ -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