From 2bd038724744d5ef72d18ff747fbb45143b2f05f Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Thu, 5 Nov 2026 13:03:16 +0100 Subject: [PATCH] fix(truenas-vm): let a failed ISO lookup reach its own error When download.truenas.com did not answer, the lookup handed an empty path to an associative array (bad array subscript) and the pipeline failed under pipefail, so the run ended with exit 1 at the SELECTED_ISO line instead of the "Could not find a stable ISO" message. The index fetch now fails on HTTP errors and retries, empty lines are skipped, and the assignment no longer aborts on an empty result. --- vm/truenas-vm.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index 4a76c3ba1..d50ccf199 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -39,7 +39,7 @@ function truenas_iso_lookup() { local pre_releases=() local all_paths=$( - curl -sL "$BASE_URL" | + curl -fsSL --retry 3 --retry-delay 2 --connect-timeout 15 --max-time 90 "$BASE_URL" | grep -oE 'href="[^"]+\.iso"' | sed 's/href="//; s/"$//' | grep -vE '(MASTER|ALPHA)' | @@ -47,6 +47,7 @@ function truenas_iso_lookup() { ) while read -r path; do + [[ -n "$path" ]] || continue local filename=$(basename "$path") local version=$(echo "$filename" | sed -E 's/.*TrueNAS-SCALE-([0-9]{2}\.[0-9]{2}(\.[0-9]+)*(-RC[0-9]|-BETA[0-9])?)\.iso.*/\1/') if [[ "$version" =~ (RC|BETA) ]]; then @@ -139,7 +140,7 @@ post_to_api_vm vm_select_storage "$HN" if [ -z "${SELECTED_ISO:-}" ]; then - SELECTED_ISO=$(truenas_iso_lookup | grep -vE 'RC|BETA' | sort -V | tail -n 1) + SELECTED_ISO=$(truenas_iso_lookup | grep -vE 'RC|BETA' | sort -V | tail -n 1) || true if [ -z "$SELECTED_ISO" ]; then msg_error "Could not find a stable ISO for fallback."