From 8130e6bdc5ffb85f93ce7858cbc65f1f8f055a43 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Wed, 24 Jul 2019 13:53:09 -0500 Subject: [PATCH] Elasticsearch: Manually verify snapshot repositories This updates the script for registering snapshot repositories to include a manual verification of the repositories created. This simply allows for inspection of all master and data nodes the repository is verified with to provide additional visibility into the state of all repositories Change-Id: I6e5386386e2b79b1cb0f41fc1f9b78817695f8f3 Signed-off-by: Steve Wilkerson --- elasticsearch/templates/bin/_register-repository.sh.tpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elasticsearch/templates/bin/_register-repository.sh.tpl b/elasticsearch/templates/bin/_register-repository.sh.tpl index 3b940bbc9..175c853f4 100644 --- a/elasticsearch/templates/bin/_register-repository.sh.tpl +++ b/elasticsearch/templates/bin/_register-repository.sh.tpl @@ -46,6 +46,11 @@ function register_snapshot_repository() { fi } +function verify_snapshot_repository() { + curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \ + -XPOST "${ELASTICSEARCH_HOST}/_snapshot/$1/_verify" +} + # Get names of all current snapshot repositories snapshot_repos=$(curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \ "${ELASTICSEARCH_HOST}"/_cat/repositories?format=json | jq -r '.[].id') @@ -56,5 +61,6 @@ if contains "$snapshot_repos" {{$repository.name}}; then echo "Snapshot repository {{$repository.name}} exists!" else register_snapshot_repository {{$repository.name}} + verify_snapshot_repository {{$repository.name}} fi {{ end }}