From 44a4f19ecc5c7b7131c04a9c391391b46ee03ae3 Mon Sep 17 00:00:00 2001 From: Tom Briden Date: Wed, 15 Apr 2015 07:54:52 +0100 Subject: [PATCH 1/5] Set NODETOOL up as an alias and include ERL_FLAGS env vars nodetool won't work with TLS distribution as the erlang vm args don't get passed in to escript. This commit reads the TLS args from the vm.args file if it exists and prefixes the call to escript with them. The only way to have this work properly is to alias the command rather than store it as a variable basho/riak#509 --- priv/base/env.sh | 14 +++++++++----- priv/base/runner | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/priv/base/env.sh b/priv/base/env.sh index cac7e27..6b75455 100755 --- a/priv/base/env.sh +++ b/priv/base/env.sh @@ -124,8 +124,12 @@ APP_VSN=${START_ERL#* } ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin # Setup command to control the node -NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NET_TICKTIME_ARG $NAME_ARG $COOKIE_ARG" -NODETOOL_LITE="$ERTS_PATH/escript $ERTS_PATH/nodetool" +if [ -f $RUNNER_ETC_DIR/vm.args ]; then + SSL_ARGS=$(grep -e '^\-ssl_dist_opt' -e '^\-proto_dist' $RUNNER_ETC_DIR/vm.args | tr '\n' ' ') + ERL_FLAGS="$ERL_FLAGS $SSL_ARGS" +fi +alias NODETOOL="ERL_FLAGS=\"$ERL_FLAGS\" $ERTS_PATH/escript $ERTS_PATH/nodetool $NET_TICKTIME_ARG $NAME_ARG $COOKIE_ARG" +alias NODETOOL_LITE="ERL_FLAGS=\"$ERL_FLAGS\" $ERTS_PATH/escript $ERTS_PATH/nodetool" ## Are we using cuttlefish (http://github.com/basho/cuttlefish) @@ -140,7 +144,7 @@ fi # Ping node without stealing stdin ping_node() { - $NODETOOL ping < /dev/null + NODETOOL ping < /dev/null } # Attempts to create a pid directory like /var/run/APPNAME and then @@ -295,7 +299,7 @@ check_config() { fi fi - MUTE=`$NODETOOL_LITE chkconfig $CONFIG_ARGS` + MUTE=`NODETOOL_LITE chkconfig $CONFIG_ARGS` if [ "$?" -ne 0 ]; then echoerr "Error reading $CONFIG_ARGS" exit 1 @@ -320,7 +324,7 @@ check_ulimit() { # Set the PID global variable, return 1 on error get_pid() { - PID=`$NODETOOL getpid < /dev/null` + PID=`NODETOOL getpid < /dev/null` if [ "$?" -ne 0 ]; then echo "Node is not running!" return 1 diff --git a/priv/base/runner b/priv/base/runner index fd48a2b..e2a041b 100755 --- a/priv/base/runner +++ b/priv/base/runner @@ -205,7 +205,7 @@ do_start() { if [ "$?" -ne 0 ]; then continue fi - PROCESS=`$NODETOOL rpcterms erlang whereis "'${WAIT_FOR_PROCESS}'."` + PROCESS=`NODETOOL rpcterms erlang whereis "'${WAIT_FOR_PROCESS}'."` if [ "$PROCESS" != "undefined" ]; then # Attempt to create a .pid file for the process create_pid_file @@ -231,7 +231,7 @@ do_stop() { fi # Tell nodetool to stop - $NODETOOL stop + NODETOOL stop ES=$? if [ "$ES" -ne 0 ]; then exit $ES From ba63c86494aa40f3c649d945612091f634008ef4 Mon Sep 17 00:00:00 2001 From: Brian Sparrow Date: Tue, 7 Feb 2017 13:16:12 -0500 Subject: [PATCH 2/5] Update RELEASE_NOTES.md for 4.0.0 --- RELEASE-NOTES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index e7233cd..7990c4d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,9 @@ +# node_package 4.0.0 + +### Breaking ALIAS change +In the 4.0 branch, the `$NODETOOL` variable has been replaced by the `NODETOOL` alias. +This change was made to support distributed Erlang built-in TLS. Please see [this issue](https://github.com/basho/riak/issues/509) for more details. + # node_package 3.0.0 ## Security Improvements ### Introduction From 6295abed21c2451b35b46e479e4145eaa614c861 Mon Sep 17 00:00:00 2001 From: Brian Sparrow Date: Tue, 7 Feb 2017 13:17:39 -0500 Subject: [PATCH 3/5] Update README for 4.0.0 release to point at release notes --- README.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.org b/README.org index 8ffab3a..44a9fae 100644 --- a/README.org +++ b/README.org @@ -1,4 +1,9 @@ * node_package + +** Release 4.0.0 - Release notes + +Please see the [[RELEASE-NOTES.md][RELEASE-NOTES.md]] for breaking changes and explanation in 4.0.0 release. + ** Release 3.0.0 - Release notes Please see [[RELEASE-NOTES.md][RELEASE-NOTES.md]] for important changes in the 3.0.0 release of `node_package` From 83f5944456466231f4b77a27c59322dcbb7b13ff Mon Sep 17 00:00:00 2001 From: Magnus Kessler Date: Fri, 10 Feb 2017 16:00:01 +0000 Subject: [PATCH 4/5] Fix for Solaris10 sh (#212) Commit 44a4f19ecc5c7b7131c04a9c391391b46ee03ae3 uses $(command) notation to populate SSL_ARGS. This notation is not supported by Solaris10 sh. Use backticks instead. Ksh expands aliases containing '=' differently from bash, but seems to work fine when an alias is evaluated inside backticks. Call NODETOOL inside backticks consistently throughout the file. As other functions depend on ping_node() returning the exit code from NODETOOL, but CLI users expect to see the stdout output, capture the exit code before echoing the command output. --- priv/base/env.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/priv/base/env.sh b/priv/base/env.sh index 6b75455..d4f86d7 100755 --- a/priv/base/env.sh +++ b/priv/base/env.sh @@ -125,7 +125,7 @@ ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin # Setup command to control the node if [ -f $RUNNER_ETC_DIR/vm.args ]; then - SSL_ARGS=$(grep -e '^\-ssl_dist_opt' -e '^\-proto_dist' $RUNNER_ETC_DIR/vm.args | tr '\n' ' ') + SSL_ARGS=`grep -e '^\-ssl_dist_opt' -e '^\-proto_dist' $RUNNER_ETC_DIR/vm.args | tr '\n' ' '` ERL_FLAGS="$ERL_FLAGS $SSL_ARGS" fi alias NODETOOL="ERL_FLAGS=\"$ERL_FLAGS\" $ERTS_PATH/escript $ERTS_PATH/nodetool $NET_TICKTIME_ARG $NAME_ARG $COOKIE_ARG" @@ -144,7 +144,10 @@ fi # Ping node without stealing stdin ping_node() { - NODETOOL ping < /dev/null + output=`NODETOOL ping < /dev/null` + status=$? + echo $output + return $status } # Attempts to create a pid directory like /var/run/APPNAME and then From ad5cc66afa6628c83b59de6ea89594ce5a4c1db6 Mon Sep 17 00:00:00 2001 From: Brian Sparrow Date: Tue, 28 Mar 2017 16:56:20 -0400 Subject: [PATCH 5/5] Use PID instead of $RANDOM to support non-bash (#217) * Update runner * Remove underscores so attach node is named properly --- priv/base/runner | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/priv/base/runner b/priv/base/runner index e2a041b..fdc55c4 100755 --- a/priv/base/runner +++ b/priv/base/runner @@ -306,9 +306,9 @@ case "$1" in echo "Remote Shell: Use \"Ctrl-G q\" to quit." echo "q() or init:stop() will terminate the $SCRIPT node." shift - RAND=$(($(($RANDOM % 1000)) + 1)) + RAND=$(($(($$ % 1000)) + 1)) NODE_NAME=${NAME_ARG#* } - exec $ERTS_PATH/erl -name c_$RAND_$NODE_NAME -hidden -remsh $NODE_NAME $COOKIE_ARG $NET_TICKTIME_ARG + exec $ERTS_PATH/erl -name c$RAND$NODE_NAME -hidden -remsh $NODE_NAME $COOKIE_ARG $NET_TICKTIME_ARG ;; console) @@ -363,7 +363,7 @@ case "$1" in node_up_check shift - RAND=$(($(($RANDOM % 1000)) + 1)) + RAND=$(($(($$ % 1000)) + 1)) NODE_NAME=${NAME_ARG#* } $ERTS_PATH/erl -noshell -noinput \ -pa $RUNNER_PATCH_DIR \