From 513c268b369b49bb92fbc738a12e604c9e2cbcde Mon Sep 17 00:00:00 2001 From: Muhammad Ibrahim Date: Thu, 2 Oct 2025 15:14:50 +0100 Subject: [PATCH] fix: Reset install_exit_code per container and detect success via output message --- agents/proxmox_auto_enroll.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/agents/proxmox_auto_enroll.sh b/agents/proxmox_auto_enroll.sh index d8d4599..b151fe0 100755 --- a/agents/proxmox_auto_enroll.sh +++ b/agents/proxmox_auto_enroll.sh @@ -4,7 +4,7 @@ set -euo pipefail # Exit on error, undefined vars, pipe failures # Trap to catch errors only (not normal exits) trap 'echo "[ERROR] Script failed at line $LINENO with exit code $?"' ERR -SCRIPT_VERSION="1.0.2" +SCRIPT_VERSION="1.0.3" echo "[DEBUG] Script Version: $SCRIPT_VERSION ($(date +%Y-%m-%d\ %H:%M:%S))" # ============================================================================= @@ -194,6 +194,9 @@ while IFS= read -r line; do # Install PatchMon agent in container info " Installing PatchMon agent..." + # Reset exit code for this container + install_exit_code=0 + # Download and execute in separate steps to avoid stdin issues with piping install_output=$(timeout 180 pct exec "$vmid" -- bash -c " cd /tmp @@ -205,11 +208,9 @@ while IFS= read -r line; do bash patchmon-install.sh && \ rm -f patchmon-install.sh " 2>&1