1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-01 23:57:05 +00:00

during wait for boot, also wait until vm has an ip address

This commit is contained in:
downtownallday 2024-09-10 14:53:12 -04:00
parent 2e0b37a09a
commit 4fedfb377d

View File

@ -201,7 +201,25 @@ lx_wait_for_boot() {
echo ""
echo -n "Wait for cloud-init "
lxc --project "$project" exec "$inst" -- cloud-init status --wait
local rc=$?
if [ $rc -eq 0 ]; then
echo "Wait for ip address "
local ip=""
local count=0
while [ $count -lt 10 ]; do
let count+=1
ip="$(lxc --project "$project" exec "$inst" -- hostname -I | awk '{print $1}')"
rc=$?
echo " [${count}] got: $ip"
if [ $rc -ne 0 -o "$ip" != "" ];then
break
fi
sleep 5
done
fi
echo ""
return $rc
}
lx_get_ssh_identity() {