From 2a9a5e74d756ec63224c50da9f13db13ea3cf305 Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Fri, 9 Apr 2021 22:20:54 +0200 Subject: [PATCH] fix(bin/emqx): print cuttlefish error --- bin/emqx | 15 +++++++++++---- rebar.config | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/emqx b/bin/emqx index 0a64313f1..da1ac8990 100755 --- a/bin/emqx +++ b/bin/emqx @@ -214,12 +214,19 @@ generate_config() { EMQX_LICENSE_CONF_OPTION="-i ${EMQX_LICENSE_CONF}" fi + set +e # shellcheck disable=SC2086 - CONFIG="$("$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/cuttlefish -v -i "$REL_DIR"/emqx.schema $EMQX_LICENSE_CONF_OPTION -c "$RUNNER_ETC_DIR"/emqx.conf -d "$RUNNER_DATA_DIR"/configs generate)" + CUTTLEFISH_OUTPUT="$("$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/cuttlefish -v -i "$REL_DIR"/emqx.schema $EMQX_LICENSE_CONF_OPTION -c "$RUNNER_ETC_DIR"/emqx.conf -d "$RUNNER_DATA_DIR"/configs generate)" + # shellcheck disable=SC2181 + RESULT=$? + set -e + if [ $RESULT -gt 0 ]; then + echo "$CUTTLEFISH_OUTPUT" + exit $RESULT + fi # print override from environment variables (EMQX_*) - echo "$CONFIG" | sed -e '$d' - CONFIG_ARGS=$(echo "$CONFIG" | tail -n 1) - + echo "$CUTTLEFISH_OUTPUT" | sed -e '$d' + CONFIG_ARGS=$(echo "$CUTTLEFISH_OUTPUT" | tail -n 1) ## Merge cuttlefish generated *.args into the vm.args CUTTLE_GEN_ARG_FILE=$(echo "$CONFIG_ARGS" | sed -n 's/^.*\(vm_args[[:space:]]\)//p' | awk '{print $1}') diff --git a/rebar.config b/rebar.config index ed7a6af15..33f3f0564 100644 --- a/rebar.config +++ b/rebar.config @@ -42,7 +42,7 @@ , {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.8.0"}}} , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.8.0"}}} , {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.0"}}} - , {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.3.0"}}} + , {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.3.1"}}} , {minirest, {git, "https://github.com/emqx/minirest", {tag, "0.3.5"}}} , {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.0"}}} , {replayq, {git, "https://github.com/emqx/replayq", {tag, "0.3.2"}}}