fix(script): emqx die if call_hocon failed

This commit is contained in:
William Yang 2021-07-16 13:59:04 +02:00 committed by turtleDeng
parent 9d9d9f2ce3
commit 3a7d0c3e84
1 changed files with 10 additions and 6 deletions

View File

@ -41,6 +41,12 @@ export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
export ERTS_LIB_DIR="$ERTS_DIR/../lib" export ERTS_LIB_DIR="$ERTS_DIR/../lib"
MNESIA_DATA_DIR="$RUNNER_DATA_DIR/mnesia/$NAME" MNESIA_DATA_DIR="$RUNNER_DATA_DIR/mnesia/$NAME"
die() {
echo >&2 "$1"
errno=${2:-1}
exit "$errno"
}
relx_usage() { relx_usage() {
command="$1" command="$1"
@ -200,8 +206,8 @@ relx_nodetool() {
call_hocon() { call_hocon() {
export RUNNER_ROOT_DIR export RUNNER_ROOT_DIR
export REL_VSN export REL_VSN
"$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" hocon "$@" "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" hocon "$@" \
return $? || die "ERROR: call_hocon failed: $*" $?
} }
# Run an escript in the node's environment # Run an escript in the node's environment
@ -275,8 +281,7 @@ generate_config() {
# shellcheck disable=SC2086 # shellcheck disable=SC2086
if ! relx_nodetool chkconfig $CONFIG_ARGS; then if ! relx_nodetool chkconfig $CONFIG_ARGS; then
echoerr "Error reading $CONFIG_ARGS" die "Error reading $CONFIG_ARGS"
exit 1
fi fi
} }
@ -366,8 +371,7 @@ if [ -z "$COOKIE" ]; then
fi fi
if [ -z "$COOKIE" ]; then if [ -z "$COOKIE" ]; then
echoerr "Please set node.cookie in $RUNNER_ETC_DIR/emqx.conf or override from environment variable EMQX_NODE_COOKIE" die "Please set node.cookie in $RUNNER_ETC_DIR/emqx.conf or override from environment variable EMQX_NODE_COOKIE"
exit 1
fi fi
# Support for IPv6 Dist. See: https://github.com/emqtt/emqttd/issues/1460 # Support for IPv6 Dist. See: https://github.com/emqtt/emqttd/issues/1460