From e5d24d28b859dd9cce620d910e840b6844c4798f Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Sun, 12 Dec 2021 15:53:19 +0700 Subject: [PATCH] Correctly show update errors in web ui (#1157) --- scripts/update/01-run.sh | 1 + scripts/update/update | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/scripts/update/01-run.sh b/scripts/update/01-run.sh index 376aff8..5416143 100755 --- a/scripts/update/01-run.sh +++ b/scripts/update/01-run.sh @@ -141,6 +141,7 @@ EOF # If this doesn't resolve the issue, start containers again before failing so the web UI is still accessible echo "That didn't work, attempting to restart containers" ./scripts/start + echo "Error stopping Docker containers" > "${UMBREL_ROOT}/statuses/update-failure" false } } diff --git a/scripts/update/update b/scripts/update/update index e807e3c..e14313a 100755 --- a/scripts/update/update +++ b/scripts/update/update @@ -139,6 +139,16 @@ rm -f "$UMBREL_ROOT"/statuses/update-in-progress update_state=$(cat "${UMBREL_ROOT}/statuses/update-status.json" | jq .state -r) +# Show error +update_failure_status_file="${UMBREL_ROOT}/statuses/update-failure" +if [[ -f "${update_failure_status_file}" ]]; then + reason=$(cat "${update_failure_status_file}") + rm "${update_failure_status_file}" + cat < "${UMBREL_ROOT}/statuses/update-status.json" +{"state": "failed", "progress": 100, "description": "${reason}", "updateTo": ""} +EOF +fi + if [[ "${update_state}" != "success" ]] && [[ "${update_state}" != "failed" ]]; then # Sleep for a few seconds to make sure the user is on the update view sleep 8