summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2017-09-28 12:28:57 +0300
committerMichael Klishin <mklishin@pivotal.io>2017-09-28 12:28:57 +0300
commit547be437426163fcd2655857e34f4d24b4994c3a (patch)
tree6a0d0c6aed6ff025156f9cf686e1dc30c2d8204c
parent644c9afd151dc963b4d6a47a5e3a1d28896499ca (diff)
downloadrabbitmq-server-git-547be437426163fcd2655857e34f4d24b4994c3a.tar.gz
Revert "Ensure that exit code 0 is used for "stop" command"
This reverts commit 1518b601036351e3f8686bab9c8ae87a8d5af0a3. There is no consensus on how it should work. In general it is impossible to tell a stopped node from a node we could not contact (with some specific exceptions reported by modern net_kernel version such as the Erlang cookie mismatch), so some believe stop should be idempotent and others believe it should not.
-rw-r--r--src/rabbit_cli.erl12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl
index da29136853..4d955f82ac 100644
--- a/src/rabbit_cli.erl
+++ b/src/rabbit_cli.erl
@@ -122,12 +122,15 @@ main(ParseFun, DoFun, UsageMod) ->
_ ->
print_error("unable to connect to node ~w: ~w", [Node, Reason]),
print_badrpc_diagnostics([Node]),
- exit_badrpc(Command)
+ case Command of
+ stop -> rabbit_misc:quit(?EX_OK);
+ _ -> rabbit_misc:quit(?EX_UNAVAILABLE)
+ end
end;
{badrpc_multi, Reason, Nodes} ->
print_error("unable to connect to nodes ~p: ~w", [Nodes, Reason]),
print_badrpc_diagnostics(Nodes),
- exit_badrpc(Command);
+ rabbit_misc:quit(?EX_UNAVAILABLE);
function_clause ->
print_error("operation ~w used with invalid parameter: ~p",
[Command, Args]),
@@ -140,11 +143,6 @@ main(ParseFun, DoFun, UsageMod) ->
rabbit_misc:quit(?EX_SOFTWARE)
end.
-exit_badrpc(stop) ->
- rabbit_misc:quit(?EX_OK);
-exit_badrpc(_) ->
- rabbit_misc:quit(?EX_UNAVAILABLE).
-
start_distribution_anon(0, LastError) ->
{error, LastError};
start_distribution_anon(TriesLeft, _) ->