Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #35 from weslambert/template-add-revise
Browse files Browse the repository at this point in the history
update evaluation of template addition success/failure
  • Loading branch information
dougburks authored Nov 14, 2018
2 parents fdbad22 + b80dd0c commit 4160236
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions usr/sbin/so-elasticsearch-template-add
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,16 @@ function add_template(){
echo
read SOURCE
fi
if curl -s -XPUT -H 'Content-Type: application/json' http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_template/$TEMPLATE -d@$SOURCE | grep "acknowledged"; then

TEMPLATE_ADD=$(curl -s -XPUT -H 'Content-Type: application/json' http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_template/$TEMPLATE -d@$SOURCE)

if echo $TEMPLATE_ADD | grep -q "acknowledged"; then
echo
echo "Template successfully added."
echo
else
echo
curl -s -XPUT -H 'Content-Type: application/json' http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_template/$TEMPLATE -d@$SOURCE
echo $TEMPLATE_ADD | jq .
echo
fi
}
Expand Down

0 comments on commit 4160236

Please sign in to comment.