Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
sleep 5
done

# NOTE: Bounded like the wait above. `cloud-init status --wait` holds for
# as long as it takes, and a boot that never ends would otherwise hold the
# update with it. 124 is what the timeout itself exits with.
# NOTE: `cloud-init status --wait` can wait forever if a boot gets stuck,
# so we cap it with a timeout, just like the SSH wait above. When time
# runs out, `timeout` exits with 124.
# NOTE: We need sudo here. On Rocky, installing a package locks
# /run/cloud-init down to root, and `cloud-init status` then fails for
# the SSH user.
booted=0
timeout {timeout} ssh -F {config} "$host" cloud-init status --wait || booted=$?
timeout {timeout} ssh -F {config} "$host" sudo -n cloud-init status --wait || booted=$?
if [ "$booted" -eq 124 ]; then
echo "$host was still booting after {timeout}s" >&2
exit 1
Expand Down
Loading