aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates/extended_bin.dtl
diff options
context:
space:
mode:
authorSteve Strong <[email protected]>2014-08-22 20:10:38 +0200
committerSteve Strong <[email protected]>2014-08-22 20:10:38 +0200
commit682f1fc05aac38e487a04d87ffb54dd646dba472 (patch)
tree27e28dfc36e024c3cd5141712920c23e0d1b3b57 /priv/templates/extended_bin.dtl
parent1d7f26d786452f53a77fba64fe5081885d26856f (diff)
downloadrelx-682f1fc05aac38e487a04d87ffb54dd646dba472.tar.gz
relx-682f1fc05aac38e487a04d87ffb54dd646dba472.tar.bz2
relx-682f1fc05aac38e487a04d87ffb54dd646dba472.zip
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 8bb3b48..10d12c6 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