mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-18 21:11:08 +02:00
fix(coreos-base/oem-vagrant): Add timeout for /etc/environment
The environment file will not be written if there are no public or private networks defined since the configure_networks hook is never run. Report an error after one minute to make this situation less confusing.
This commit is contained in:
parent
8b1ff15435
commit
f16d776db2
@ -7,7 +7,17 @@ if [ -z "$ENV" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
now=$(date +%s)
|
||||||
|
timeout=$(( now + 60 ))
|
||||||
|
|
||||||
# just block until cloudinit updates environment
|
# just block until cloudinit updates environment
|
||||||
while ! grep -qs ^COREOS_PUBLIC_IPV4 "$ENV"; do
|
while ! grep -qs ^COREOS_PUBLIC_IPV4 "$ENV"; do
|
||||||
|
if [[ $timeout -lt $(date +%s) ]]; then
|
||||||
|
echo "No network configuration provided by Vagrant!" >&2
|
||||||
|
echo "Using localhost, for default public and private IPs" >&2
|
||||||
|
echo "COREOS_PUBLIC_IPV4=127.0.0.1" >> "$ENV"
|
||||||
|
echo "COREOS_PRIVATE_IPV4=127.0.0.1" >> "$ENV"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user