From 74efdcccaa0ac364149b6369931eceb4e77518ed Mon Sep 17 00:00:00 2001 From: Martin Cox Date: Fri, 10 May 2019 17:33:10 +0100 Subject: [PATCH] Change the chkconfig script to 'nodetool eval' with inline erlang for handling consult. Seems cleaner than having a couple of files to handle a simple task - this is what we were trying to achieve in Leeds. --- rebar.config | 1 - rel/files/check_riak_config | 11 ----------- rel/files/riak-chkconfig | 13 ++++++++++++- 3 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 rel/files/check_riak_config diff --git a/rebar.config b/rebar.config index 5eba13c60..fb8f40de0 100644 --- a/rebar.config +++ b/rebar.config @@ -84,7 +84,6 @@ {template, "rel/files/riak-debug", "bin/riak-debug"}, {template, "rel/files/riak-chkconfig", "bin/riak-chkconfig"}, {template, "rel/files/riak-repl", "bin/riak-repl"}, - {template, "rel/files/check_riak_config", "bin/check_riak_config"}, {copy, "rel/files/check_ulimit", "bin/hooks/prestart/check_ulimit"} ]}, diff --git a/rel/files/check_riak_config b/rel/files/check_riak_config deleted file mode 100644 index d643cad46..000000000 --- a/rel/files/check_riak_config +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env escript -%% -*- erlang -*- - -main([ConfigPath]) -> - try - {ok, _} = file:consult(ConfigPath), - io:format("config is OK\n") - catch - _:_ -> - io:format("Error reading ~p\n", [ConfigPath]) - end. diff --git a/rel/files/riak-chkconfig b/rel/files/riak-chkconfig index df7f8946f..9d521460e 100644 --- a/rel/files/riak-chkconfig +++ b/rel/files/riak-chkconfig @@ -8,5 +8,16 @@ ## "vm.args = $VMARGS_PATH" ## "app.config = $CONFIG_PATH" -$ERTS_DIR/bin/escript $RELEASE_ROOT_DIR/bin/check_riak_config $CONFIG_PATH +CODE=" try + {ok, _} = file:consult(\"$CONFIG_PATH\"), + io:format(\"config is OK\\n\"), + halt(0) + catch + _:_ -> + io:format(\"Error reading ~p\\n\", [\"$CONFIG_PATH\"]), + halt(1) + end." + +$BINDIR/erl -noshell -boot start_clean -eval "$CODE" + echo $CUTTLE_CONF