Ensure cloud-init has finished running

We need to wait for cloud-init to be completely finished since it is
registering RHEL instances with RHN and preparing a swap file.

Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
Major Hayden 2020-06-30 07:47:58 -05:00 committed by Ondřej Budai
parent 9011a67dd0
commit dd0fc32b02
2 changed files with 11 additions and 0 deletions

View file

@ -30,3 +30,13 @@ echo -e "\033[0m"
echo "List of installed packages:"
rpm -qa | sort
echo "------------------------------------------------------------------------------"
# Ensure cloud-init has completely finished on the instance. This ensures that
# the instance is fully ready to go.
while true; do
if [[ -f /var/lib/cloud/instance/boot-finished ]]; then
break
fi
echo -e "\n🤔 Waiting for cloud-init to finish running..."
sleep 5
done