Skip to content

Commit

Permalink
Merge pull request #1786 from jcantrill/1748478_deux
Browse files Browse the repository at this point in the history
Bug 1748478: Add more states to init probe
  • Loading branch information
openshift-merge-robot committed Nov 14, 2019
2 parents c9147d0 + 16c4c00 commit c1dfa00
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions elasticsearch/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ source "logging"
wait_for_port_open
failed=0

touch ${HOME}/init_running
pushd "${ES_HOME}/init"
files=$(ls --hide common | sort)
for init_file in ${files}; do
Expand All @@ -29,6 +30,7 @@ pushd "${ES_HOME}/init"
done
popd

rm -f ${HOME}/init_running
if [ $failed -eq 0 ]; then
touch ${HOME}/init_complete
fi
15 changes: 14 additions & 1 deletion elasticsearch/probe/readiness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,22 @@ function check_if_ready() {
fi
}

function check_for_init_running() {
test -f ${HOME}/init_running
}

function check_for_init_complete() {
test -f ${HOME}/init_complete
}

function show_failures() {
if [ -f ${HOME}/init_failures ]; then
cat ${HOME}/init_failures
else
# this should never happen"
echo "Elasticsearch node is in unknown state"
fi
}

check_if_ready "/" "Elasticsearch node is not ready to accept HTTP requests yet"
check_for_init_complete || cat ${HOME}/init_failures
check_for_init_complete || ( check_for_init_running && echo "Elasticsearch node is initializing" ) || show_failures

0 comments on commit c1dfa00

Please sign in to comment.