Report container build failures to API before cleanup

Adds calls to post_update_to_api to notify the API of container build failures before prompting for container cleanup in both build and error handler scripts.
This commit is contained in:
CanbiZ 2025-12-08 15:12:31 +01:00
parent 50c1b8f492
commit 9e4d367415
2 changed files with 8 additions and 0 deletions

View File

@ -3262,6 +3262,9 @@ EOF'
exit $install_exit_code
fi
# Report failure to API before container cleanup
post_update_to_api "failed" "$install_exit_code"
# Prompt user for cleanup with 60s timeout (plain echo - no msg_info to avoid spinner)
echo ""
echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"

View File

@ -213,6 +213,11 @@ error_handler() {
# Offer to remove container if it exists (build errors after container creation)
if [[ -n "${CTID:-}" ]] && command -v pct &>/dev/null && pct status "$CTID" &>/dev/null; then
# Report failure to API before container cleanup
if declare -f post_update_to_api &>/dev/null; then
post_update_to_api "failed" "$exit_code"
fi
echo ""
echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"