Comment out debug output in create_lxc_container

Disabled various debug echo and msg_debug statements in the create_lxc_container function to reduce console output during normal operation. This helps keep logs cleaner while retaining the code for future debugging if needed.
This commit is contained in:
CanbiZ 2025-10-24 09:10:27 +02:00
parent b3fcb5addf
commit dae2223a38

View File

@ -3001,9 +3001,9 @@ create_lxc_container() {
# 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'"
echo "[DEBUG] TEMPLATE_PATTERN='$TEMPLATE_PATTERN'" #echo "[DEBUG] TEMPLATE_PATTERN='$TEMPLATE_PATTERN'"
mapfile -t LOCAL_TEMPLATES < <( mapfile -t LOCAL_TEMPLATES < <(
pveam list "$TEMPLATE_STORAGE" 2>/dev/null | pveam list "$TEMPLATE_STORAGE" 2>/dev/null |
@ -3013,16 +3013,15 @@ create_lxc_container() {
pveam update >/dev/null 2>&1 || msg_warn "Could not update template catalog (pveam update failed)." pveam update >/dev/null 2>&1 || msg_warn "Could not update template catalog (pveam update failed)."
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 set +u
mapfile -t ONLINE_TEMPLATES \ mapfile -t ONLINE_TEMPLATES < <(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)
\ #echo "[DEBUG] After filtering: ${#ONLINE_TEMPLATES[@]} online templates found"
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 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
echo " - $tmpl" echo " - $tmpl"
done done
@ -3031,15 +3030,15 @@ create_lxc_container() {
ONLINE_TEMPLATE="" ONLINE_TEMPLATE=""
[[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]] && ONLINE_TEMPLATE="${ONLINE_TEMPLATES[-1]}" [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]] && ONLINE_TEMPLATE="${ONLINE_TEMPLATES[-1]}"
msg_debug "SEARCH_PATTERN='${SEARCH_PATTERN}' TEMPLATE_PATTERN='${TEMPLATE_PATTERN}'" #msg_debug "SEARCH_PATTERN='${SEARCH_PATTERN}' TEMPLATE_PATTERN='${TEMPLATE_PATTERN}'"
msg_debug "Found ${#LOCAL_TEMPLATES[@]} local templates, ${#ONLINE_TEMPLATES[@]} online templates" #msg_debug "Found ${#LOCAL_TEMPLATES[@]} local templates, ${#ONLINE_TEMPLATES[@]} online templates"
if [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]]; then if [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]]; then
msg_debug "First 3 online templates:" #msg_debug "First 3 online templates:"
for i in {0..2}; do for i in {0..2}; do
[[ -n "${ONLINE_TEMPLATES[$i]}" ]] && msg_debug " [$i]: ${ONLINE_TEMPLATES[$i]}" [[ -n "${ONLINE_TEMPLATES[$i]}" ]] && msg_debug " [$i]: ${ONLINE_TEMPLATES[$i]}"
done done
fi fi
msg_debug "ONLINE_TEMPLATE='$ONLINE_TEMPLATE'" #msg_debug "ONLINE_TEMPLATE='$ONLINE_TEMPLATE'"
if [[ ${#LOCAL_TEMPLATES[@]} -gt 0 ]]; then if [[ ${#LOCAL_TEMPLATES[@]} -gt 0 ]]; then
TEMPLATE="${LOCAL_TEMPLATES[-1]}" TEMPLATE="${LOCAL_TEMPLATES[-1]}"