continue loop after encountering error with first

This commit is contained in:
reyesj2
2025-04-21 20:32:42 -05:00
parent 166e4e0ebc
commit e17fea849a

View File

@@ -44,6 +44,7 @@ for AGENT_POLICY in $agent_policies; do
if [[ "$PACKAGE_VERSION" != "$AVAILABLE_VERSION" ]]; then if [[ "$PACKAGE_VERSION" != "$AVAILABLE_VERSION" ]]; then
# Dry run of the upgrade # Dry run of the upgrade
echo ""
echo "Current $PACKAGE_NAME package version ($PACKAGE_VERSION) is not the same as the latest available package ($AVAILABLE_VERSION)..." echo "Current $PACKAGE_NAME package version ($PACKAGE_VERSION) is not the same as the latest available package ($AVAILABLE_VERSION)..."
echo "Upgrading $INTEGRATION..." echo "Upgrading $INTEGRATION..."
echo "Starting dry run..." echo "Starting dry run..."
@@ -55,12 +56,12 @@ for AGENT_POLICY in $agent_policies; do
echo "No errors detected. Proceeding with upgrade..." echo "No errors detected. Proceeding with upgrade..."
elastic_fleet_integration_policy_upgrade "$INTEGRATION_ID" elastic_fleet_integration_policy_upgrade "$INTEGRATION_ID"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: Upgrade failed for integration ID '$INTEGRATION_ID'." echo "Error: Upgrade failed for $PACKAGE_NAME with integration ID '$INTEGRATION_ID'."
exit 1 continue
fi fi
else else
echo "Errors detected during dry run. Stopping upgrade..." echo "Errors detected during dry run. Skipping $PACKAGE_NAME policy upgrade..."
exit 1 continue
fi fi
fi fi
{%- if not AUTO_UPGRADE_INTEGRATIONS %} {%- if not AUTO_UPGRADE_INTEGRATIONS %}