elastic_fleet_integration_policy_package_version

This commit is contained in:
reyesj2
2025-09-18 10:21:07 -05:00
parent 24a0fa3f6d
commit 8b07ff453d

View File

@@ -171,13 +171,13 @@ elastic_fleet_integration_policy_package_version() {
AGENT_POLICY=$1 AGENT_POLICY=$1
INTEGRATION=$2 INTEGRATION=$2
if output=$(curl -s -K /opt/so/conf/elasticsearch/curl.config -L -X GET "localhost:5601/api/fleet/agent_policies/$AGENT_POLICY" --fail); then if output=$(fleet_api "localhost:5601/api/fleet/agent_policies/$AGENT_POLICY"); then
if version=$(jq -e -r --arg INTEGRATION "$INTEGRATION" '.item.package_policies[] | select(.name==$INTEGRATION)| .package.version' <<< $output); then if version=$(jq -e -r --arg INTEGRATION "$INTEGRATION" '.item.package_policies[] | select(.name==$INTEGRATION)| .package.version' <<< "$output"); then
echo "$version" echo "$version"
fi fi
else else
echo "Error: Failed to retrieve agent policy $AGENT_POLICY" echo "Error: Failed to retrieve agent policy $AGENT_POLICY"
exit 1 return 1
fi fi
} }