Tweak template search debug test to avoid unbound var
Some checks are pending
Bump build.func Revision / bump-revision (push) Waiting to run

This commit is contained in:
vhsdream 2025-10-22 17:07:58 -04:00
parent d6def3ffed
commit b3fcb5addf

View File

@ -2999,7 +2999,7 @@ create_lxc_container() {
msg_info "Searching for template '$TEMPLATE_SEARCH'" msg_info "Searching for template '$TEMPLATE_SEARCH'"
# Build regex patterns outside awk/grep for clarity # Build regex patterns outside awk/grep for clarity
SEARCH_PATTERN="^${TEMPLATE_SEARCH}-" SEARCH_PATTERN="^${TEMPLATE_SEARCH}"
echo "[DEBUG] TEMPLATE_SEARCH='$TEMPLATE_SEARCH'" echo "[DEBUG] TEMPLATE_SEARCH='$TEMPLATE_SEARCH'"
echo "[DEBUG] SEARCH_PATTERN='$SEARCH_PATTERN'" echo "[DEBUG] SEARCH_PATTERN='$SEARCH_PATTERN'"
@ -3016,9 +3016,11 @@ create_lxc_container() {
echo "[DEBUG] pveam available output (first 5 lines with .tar files):" echo "[DEBUG] pveam available output (first 5 lines with .tar files):"
pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | head -5 | sed 's/^/ /' pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | head -5 | sed 's/^/ /'
set +u
mapfile -t ONLINE_TEMPLATES \ mapfile -t ONLINE_TEMPLATES \
\ \
echo "[DEBUG] After filtering: ${#ONLINE_TEMPLATES[@]} online templates found" < <(pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | awk -F'\t' '{print $1}' | grep -E "${SEARCH_PATTERN}.*${TEMPLATE_PATTERN}" | sort -t - -k 2 -V 2>/dev/null || true) echo "[DEBUG] After filtering: ${#ONLINE_TEMPLATES[@]} online templates found" < <(pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | awk '{print $2}' | grep -E "${SEARCH_PATTERN}.*${TEMPLATE_PATTERN}" | sort -t - -k 2 -V 2>/dev/null || true)
set -u
if [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]]; then if [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]]; then
echo "[DEBUG] Online templates:" echo "[DEBUG] Online templates:"
for tmpl in "${ONLINE_TEMPLATES[@]}"; do for tmpl in "${ONLINE_TEMPLATES[@]}"; do