Skip to content

Commit

Permalink
move variable to right scope
Browse files Browse the repository at this point in the history
  • Loading branch information
makelicious committed Aug 14, 2024
1 parent c750570 commit 98f37de
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions infrastructure/elasticsearch/setup-elastalert-indices.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@ if [ "$bulk_delete_status_code" -ne 200 ]; then
echo "Could not delete indices. API returned status code: $bulk_delete_status_code"
fi


non_404_error_when_deleting_one_by_one=0

if [ "$bulk_delete_status_code" -eq 404 ]; then
echo "Some of the indices do not exist. Attempting to delete them one by one."

# Convert the comma-separated indices into an array
IFS=',' read -r -a indices_array <<< "$indices"



non_404_error_when_deleting_one_by_one=0

for index in "${indices_array[@]}"; do
echo "Deleting index: $index"
individual_delete_status_code=$($docker_command --connect-timeout 60 -u elastic:$ELASTICSEARCH_SUPERUSER_PASSWORD -o /dev/null -w '%{http_code}' "http://elasticsearch:9200/${index}" -X DELETE)
Expand Down

0 comments on commit 98f37de

Please sign in to comment.