aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates/extended_bin.dtl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2014-09-27 15:29:20 -0500
committerTristan Sloughter <[email protected]>2014-09-27 15:29:20 -0500
commitce8ee501c9bfd350f97113acfc03c89f0d4af982 (patch)
treed317eaaa0613fcaaf34c7dcc688d006089d7bf98 /priv/templates/extended_bin.dtl
parenta78c332f2763d721c0567992ea55c1ed3f9b05b6 (diff)
parent682f1fc05aac38e487a04d87ffb54dd646dba472 (diff)
downloadrelx-ce8ee501c9bfd350f97113acfc03c89f0d4af982.tar.gz
relx-ce8ee501c9bfd350f97113acfc03c89f0d4af982.tar.bz2
relx-ce8ee501c9bfd350f97113acfc03c89f0d4af982.zip
Merge pull request #222 from srstrong/master
Modified error handling around nodetool to reduce silent failures
Diffstat (limited to 'priv/templates/extended_bin.dtl')
-rw-r--r--priv/templates/extended_bin.dtl42
1 files changed, 16 insertions, 26 deletions
diff --git a/priv/templates/extended_bin.dtl b/priv/templates/extended_bin.dtl
index a8e8d33..f38e51a 100644
--- a/priv/templates/extended_bin.dtl
+++ b/priv/templates/extended_bin.dtl
@@ -48,8 +48,9 @@ relx_gen_id() {
# Control a node
relx_nodetool() {
command="$1"; shift
+
"$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \
- -setcookie "$COOKIE" "$command" $@
+ -setcookie "$COOKIE" "$command" $@
}
# Output a start command for the last argument of run_erl
@@ -191,10 +192,8 @@ case "$1" in
PID=$(ps -efw|grep "$SCRIPT_DIR/.*/[b]eam"|awk '{print $2}')
;;
esac
- relx_nodetool "stop"
- ES="$?"
- if [ "$ES" -ne 0 ]; then
- exit "$ES"
+ if ! relx_nodetool "stop"; then
+ exit $?
fi
while $(kill -0 "$PID" 2>/dev/null);
do
@@ -204,36 +203,29 @@ case "$1" in
restart)
## Restart the VM without exiting the process
- relx_nodetool "restart"
- ES="$?"
- if [ "$ES" -ne 0 ]; then
- exit $ES
+ if ! relx_nodetool "restart"; then
+ exit $?
fi
;;
reboot)
## Restart the VM completely (uses heart to restart it)
- relx_nodetool "reboot"
- ES="$?"
- if [ "$ES" -ne 0 ]; then
- exit $ES
+ if ! relx_nodetool "reboot"; then
+ exit $?
fi
;;
ping)
## See if the VM is alive
- relx_nodetool "ping"
- ES="$?"
- if [ "$ES" -ne 0 ]; then
- exit $ES
+ if ! relx_nodetool "ping"; then
+ exit $?
fi
;;
attach)
# Make sure a node IS running
- RES="$(relx_nodetool "ping")"
- ES="$?"
- if [ "$ES" -ne 0 ]; then
+ if ! relx_nodetool "ping" > /dev/null; then
+ ES="$?"
echo "Node is not running!"
exit $ES
fi
@@ -244,9 +236,8 @@ case "$1" in
remote_console)
# Make sure a node IS running
- RES="$(relx_nodetool "ping")"
- ES="$?"
- if [ "$ES" -ne 0 ]; then
+ if ! relx_nodetool "ping" > /dev/null; then
+ ES="$?"
echo "Node is not running!"
exit $ES
fi
@@ -264,9 +255,8 @@ case "$1" in
fi
# Make sure a node IS running
- RES="$(relx_nodetool "ping")"
- ES="$?"
- if [ "$ES" -ne 0 ]; then
+ if ! relx_nodetool "ping" > /dev/null; then
+ ES="$?"
echo "Node is not running!"
exit $ES
fi