From 70af3cec534dfa2c5122893ce73ed1c9b29632d4 Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:48:10 -0500 Subject: [PATCH] avoid using 'failure' until all loops are done so so-verify doesn't flag it --- .../elasticfleet/tools/sbin/so-elastic-agent-install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/salt/elasticfleet/tools/sbin/so-elastic-agent-install b/salt/elasticfleet/tools/sbin/so-elastic-agent-install index dda3f1672..fd6bceeff 100644 --- a/salt/elasticfleet/tools/sbin/so-elastic-agent-install +++ b/salt/elasticfleet/tools/sbin/so-elastic-agent-install @@ -19,11 +19,11 @@ check_agent_health() { if elastic-agent status 2>/dev/null | grep -A1 'elastic-agent$' | grep -q 'status: (HEALTHY)'; then return 0 fi - echo "elastic-agent is not yet healthy. Waiting for ${interval} seconds before checking again..." + echo "The Elastic Agent is not yet healthy. Waiting for ${interval} seconds before checking again..." sleep "$interval" done - echo "elastic-agent did not become healthy within ${timeout} seconds" + echo "The Elastic Agent did not become healthy within ${timeout} seconds" return 1 } @@ -41,7 +41,7 @@ if [[ -z "$GRIDNODETOKEN" ]]; then fi if [[ ! -x /opt/so/so-elastic-agent_linux_amd64 ]]; then - echo "Downloading elastic-agent installer... This could take a while if another Salt job is running." + echo "Downloading so-elastic-agent installer... This could take a while if another Salt job is running." salt-call state.sls_id pull_agent_installer elasticfleet.install_agent_grid queue=True fi @@ -50,7 +50,7 @@ if [[ -x /opt/so/so-elastic-agent_linux_amd64 ]]; then cd /opt/so/ || exit 1 while [[ $attempts -lt 3 ]]; do - if ./so-elastic-agent_linux_amd64 -token="$GRIDNODETOKEN" -force; echo "Verifying elastic-agent health..." && check_agent_health; then + if ./so-elastic-agent_linux_amd64 -token="$GRIDNODETOKEN" -force; echo "Verifying Elastic Agent health..." && check_agent_health; then rm -f /opt/so/so-elastic-agent_linux_amd64 elastic-agent status @@ -60,12 +60,12 @@ if [[ -x /opt/so/so-elastic-agent_linux_amd64 ]]; then attempts=$((attempts + 1)) if [[ $attempts -lt 3 ]]; then - echo "so-elastic-agent installer failed. Retrying in 20 seconds..." + echo "Unable to verify Elastic Agent health... Retrying in 20 seconds..." sleep 20 fi done - echo "so-elastic-agent installer failed after 3 attempts. Exiting." + echo "The so-elastic-agent installer failed after 3 attempts. Exiting." exit 1 else