diff --git a/salt/elasticfleet/tools/sbin/so-elastic-fleet-integration-policy-load b/salt/elasticfleet/tools/sbin/so-elastic-fleet-integration-policy-load index 2cd9401d1..b8adfb76c 100644 --- a/salt/elasticfleet/tools/sbin/so-elastic-fleet-integration-policy-load +++ b/salt/elasticfleet/tools/sbin/so-elastic-fleet-integration-policy-load @@ -59,9 +59,6 @@ if [ ! -f /opt/so/state/eaintegrations.txt ]; then fi fi done - if [[ "$RETURN_CODE" != "1" ]]; then - touch /opt/so/state/eaintegrations.txt - fi # Grid Nodes - Heavy for INTEGRATION in /opt/so/conf/elastic-fleet/integrations/grid-nodes_heavy/*.json; do @@ -85,9 +82,6 @@ if [ ! -f /opt/so/state/eaintegrations.txt ]; then fi fi done - if [[ "$RETURN_CODE" != "1" ]]; then - touch /opt/so/state/eaintegrations.txt - fi # Fleet Server - Optional integrations for INTEGRATION in /opt/so/conf/elastic-fleet/integrations-optional/FleetServer*/*.json; do @@ -115,6 +109,7 @@ if [ ! -f /opt/so/state/eaintegrations.txt ]; then fi done + # Only create the state file if all policies were created/updated successfully if [[ "$RETURN_CODE" != "1" ]]; then touch /opt/so/state/eaintegrations.txt fi