From 9e4d36741566f84362a8be293962c26c1448f800 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 8 Dec 2025 15:12:31 +0100 Subject: [PATCH] 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. --- misc/build.func | 3 +++ misc/error_handler.func | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/misc/build.func b/misc/build.func index 7f832630a..3b9a9921c 100644 --- a/misc/build.func +++ b/misc/build.func @@ -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}" diff --git a/misc/error_handler.func b/misc/error_handler.func index d44250c62..e199958e9 100644 --- a/misc/error_handler.func +++ b/misc/error_handler.func @@ -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}"