From c0bbfb3447026c32f8aa0227a83e6a0325ba9b95 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 29 Jul 2026 17:22:18 -0500 Subject: [PATCH] update --- defaults.inc | 2 +- inc/cluster-update.inc | 12 +++++++++++- run.sh | 2 +- tests/test-cluster-update.sh | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/defaults.inc b/defaults.inc index a4158af..fe593dd 100755 --- a/defaults.inc +++ b/defaults.inc @@ -3,7 +3,7 @@ action="${1:-}" FOLDER='/opt/idssys/ta-proxmenu' -VERS='2026.7.28-11' +VERS='2026.7.29-1' noupdate=' ' diff --git a/inc/cluster-update.inc b/inc/cluster-update.inc index f4133d0..b94a5c1 100644 --- a/inc/cluster-update.inc +++ b/inc/cluster-update.inc @@ -104,10 +104,12 @@ INSTALL_CLUSTER_UPDATES() { continue fi if [[ "$status" != "online" ]]; then + printf '\n' echo -e "${idsCL[LightYellow]}Skipping ${node}: node status is ${status}.${idsCL[Default]}" cluster_failed=1 continue fi + printf '\n' echo -e "${idsCL[LightCyan]}Updating remote node ${node}...${idsCL[Default]}" if TAPM_UPDATE_REMOTE_NODE "$node"; then echo -e "${idsCL[Green]}Remote node ${node} is updated.${idsCL[Default]}" @@ -117,8 +119,16 @@ INSTALL_CLUSTER_UPDATES() { fi done + printf '\n' echo -e "${idsCL[LightCyan]}Updating local node ${local_node}...${idsCL[Default]}" - INSTALL_LOCAL_UPDATES || cluster_failed=1 + if INSTALL_LOCAL_UPDATES; then + echo -e "${idsCL[Green]}Local node ${local_node} is updated.${idsCL[Default]}" + else + echo -e "${idsCL[Red]}Local node ${local_node} failed to update.${idsCL[Default]}" + cluster_failed=1 + fi + + printf '\n' if (( cluster_failed == 0 )); then echo -e "${idsCL[Green]}TA-ProxMenu is updated on all ${#cluster_nodes[@]} cluster node(s).${idsCL[Default]}" return 0 diff --git a/run.sh b/run.sh index c8e3ffa..f453d14 100755 --- a/run.sh +++ b/run.sh @@ -165,7 +165,7 @@ INSTALL_LOCAL_UPDATES() { if (( update_failed == 0 )); then source /opt/idssys/ta-proxmenu/defaults.inc - echo -e "\n${idsCL[Green]}Update check complete. Installed version: ${VERS}${idsCL[Default]}" + echo -e "${idsCL[Green]}Update check complete. Installed version: ${VERS}${idsCL[Default]}" return 0 fi diff --git a/tests/test-cluster-update.sh b/tests/test-cluster-update.sh index b742f66..9d0f288 100644 --- a/tests/test-cluster-update.sh +++ b/tests/test-cluster-update.sh @@ -62,4 +62,18 @@ assert_equal $'remote:pve2\nlocal:pve1' \ "$(cat "$update_log")" \ "online remotes and initiating node update once" +TAPM_CLUSTER_NODE_ROWS() { + printf 'pve1\tonline\npve2\tonline\n' +} +TAPM_UPDATE_REMOTE_NODE() { + printf 'remote update output\n' +} +INSTALL_LOCAL_UPDATES() { + printf 'local update output\n' +} +expected_output=$'Updating TA-ProxMenu across 2 cluster node(s)...\n\nUpdating remote node pve2...\nremote update output\nRemote node pve2 is updated.\n\nUpdating local node pve1...\nlocal update output\nLocal node pve1 is updated.\n\nTA-ProxMenu is updated on all 2 cluster node(s).' +assert_equal "$expected_output" \ + "$(INSTALL_CLUSTER_UPDATES)" \ + "each node update is grouped with blank lines only between node blocks" + finish_tests