Fix firstboot tls bundle script and prep checks
This commit is contained in:
@@ -169,6 +169,7 @@ sys.exit(1)
|
||||
check_firstboot() {
|
||||
local url="$1"
|
||||
local body state error_present
|
||||
local done_present error_file_present log_present state_present
|
||||
if ! body="$(remote_cmd "curl -fsS --max-time 5 $url")"; then
|
||||
status FAIL "firstboot API not reachable"
|
||||
return
|
||||
@@ -186,10 +187,26 @@ check_firstboot() {
|
||||
status FAIL "firstboot status invalid or missing"
|
||||
return
|
||||
fi
|
||||
done_present="$(remote_sudo_cmd "test -f /var/lib/pikit/firstboot/firstboot.done && echo yes || echo no" 2>/dev/null || true)"
|
||||
error_file_present="$(remote_sudo_cmd "test -f /var/lib/pikit/firstboot/firstboot.error && echo yes || echo no" 2>/dev/null || true)"
|
||||
log_present="$(remote_sudo_cmd "test -f /var/lib/pikit/firstboot/firstboot.log && echo yes || echo no" 2>/dev/null || true)"
|
||||
state_present="$(remote_sudo_cmd "test -f /var/lib/pikit/firstboot/state.json && echo yes || echo no" 2>/dev/null || true)"
|
||||
if [ "$state" = "done" ] && [ "$error_present" != "true" ]; then
|
||||
status OK "firstboot completed"
|
||||
return
|
||||
fi
|
||||
if [ "$state" = "error" ] || [ "$error_present" = "true" ] || [ "$error_file_present" = "yes" ]; then
|
||||
status FAIL "firstboot failed (state=$state error=$error_present)"
|
||||
return
|
||||
fi
|
||||
if [ "$done_present" = "yes" ]; then
|
||||
status FAIL "firstboot state mismatch (done file present but state=$state)"
|
||||
return
|
||||
fi
|
||||
if [ "$log_present" != "yes" ] && [ "$state_present" != "yes" ]; then
|
||||
status WARN "firstboot not started yet (image prepped?)"
|
||||
else
|
||||
status FAIL "firstboot not complete (state=$state error=$error_present)"
|
||||
status WARN "firstboot in progress (state=$state)"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user