Skip to content

Commit 795d717

Browse files
authored
[elasticsearch] remove post-run sentinel file in the init hook (#3052)
Remove the post-run sentinel file in init hook before the run hook is executed. This fixes a race where the post-run hook could touch the sentinel file before the run hook could delete it. Fixes: https://buildkite.com/chef/chef-automate-master-nightly/builds/365#5c0180b9-8a97-4a14-8be9-77d304b7d248 Signed-off-by: Ryan Cragun ryan@chef.io
1 parent 307e3ff commit 795d717

File tree

2 files changed

+9
-8
lines changed
  • components/automate-elasticsearch/habitat/hooks

2 files changed

+9
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
#!{{pkgPathFor "core/bash"}}/bin/bash
22

33
# *** WARNING ***
4-
# Please put potentially long-running and/or complex operations in the init hook rather
5-
# than the run hook until the issue described in
4+
# Please put potentially long-running and/or complex operations in the run
5+
# hook rather than the run init until the issue described in
66
#
77
# https://github.com/habitat-sh/habitat/issues/1973
88
#
99
# has been resolved.
10-
# Currently, the Habitat `init` and `health_check` hooks run directly from the main loop
11-
# of the Habitat supervisor. If these hooks hang or take too long to run, they can block
10+
#
11+
# Currently, the Habitat `init` hook runs directly from the main loop of the
12+
# Habitat supervisor. If these hooks hang or take too long to run, they can block
1213
# execution of the supervisor.
1314
#
1415

16+
# Make sure the old post-run sentinel file does not exist
17+
source {{pkg.svc_config_path}}/health_check
18+
[[ -f ${POST_RUN_SENTINEL} ]] && rm ${POST_RUN_SENTINEL}
19+
1520
mkdir -p {{pkg.svc_var_path}}/logs
1621
mkdir -p {{pkg.svc_var_path}}/plugins
1722
mkdir -p {{pkg.svc_var_path}}/tmp

components/automate-elasticsearch/habitat/hooks/run

-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,5 @@ export ES_PATH_CONF="{{pkg.svc_config_path}}"
2323
source {{pkg.svc_config_path}}/init_keystore
2424
source {{pkg.svc_config_path}}/init_ca
2525

26-
# Make sure the old post-run sentinel file does not exist
27-
source {{pkg.svc_config_path}}/health_check
28-
[[ -f ${POST_RUN_SENTINEL} ]] && rm ${POST_RUN_SENTINEL}
29-
3026
exec elasticsearch
3127
{{~/if}}

0 commit comments

Comments
 (0)