From f3aaee1e414379fc22443d262f5231ec041e6a71 Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:59:41 -0500 Subject: [PATCH] update elastic_fleet_agent_policy_ids scripts already check rc --- salt/elasticfleet/tools/sbin/so-elastic-fleet-common | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/salt/elasticfleet/tools/sbin/so-elastic-fleet-common b/salt/elasticfleet/tools/sbin/so-elastic-fleet-common index 8945c37d9..bbc8dd85f 100644 --- a/salt/elasticfleet/tools/sbin/so-elastic-fleet-common +++ b/salt/elasticfleet/tools/sbin/so-elastic-fleet-common @@ -131,10 +131,11 @@ elastic_fleet_installed_packages() { } elastic_fleet_agent_policy_ids() { - curl -s -K /opt/so/conf/elasticsearch/curl.config -b "sid=$SESSIONCOOKIE" -L -X GET "localhost:5601/api/fleet/agent_policies" | jq -r .items[].id - if [ $? -ne 0 ]; then + if output=$(curl -s -K /opt/so/conf/elasticsearch/curl.config -b "sid=$SESSIONCOOKIE" -L -X GET "localhost:5601/api/fleet/agent_policies" --retry 3 --fail 2>/dev/null); + echo "$output" | jq -r .items[].id + else echo "Error: Failed to retrieve agent policies." - exit 1 + return 1 fi }