summaryrefslogtreecommitdiff
path: root/src/rabbit.erl
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-02-02 14:16:48 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-02-02 14:16:48 +0000
commit150fbb73d78d7eae9e57b87601856db0a9abfe0b (patch)
treeeae0bb0dd93d108f35309d6d5539454ffd703c45 /src/rabbit.erl
parent0151a42ccf01e2b7c1608fc1a88b5ee183d361c3 (diff)
downloadrabbitmq-server-git-150fbb73d78d7eae9e57b87601856db0a9abfe0b.tar.gz
Unify the more resilient hostname check, refactor out this code into a new module.
Diffstat (limited to 'src/rabbit.erl')
-rw-r--r--src/rabbit.erl36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 293864ea11..5ada38d270 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -22,7 +22,7 @@
status/0, is_running/0, is_running/1, environment/0,
rotate_logs/1, force_event_refresh/0]).
--export([start/2, stop/1, diagnostics/1]).
+-export([start/2, stop/1]).
-export([log_location/1]). %% for testing
@@ -236,7 +236,6 @@
{'required',[any(),...]}}} |
{'ok',pid()}).
-spec(stop/1 :: (_) -> 'ok').
--spec(diagnostics/1 :: ([node()]) -> string()).
-endif.
@@ -510,7 +509,7 @@ boot_step_error({error, {timeout_waiting_for_tables, _}}, _Stacktrace) ->
Ns -> {format("Timeout contacting cluster nodes: ~p.~n",
[Ns]), Ns}
end,
- boot_error(Err ++ diagnostics(Nodes) ++ "~n~n", []);
+ boot_error(Err ++ rabbit_nodes:diagnostics(Nodes) ++ "~n~n", []);
boot_step_error(Reason, Stacktrace) ->
boot_error("Error description:~n ~p~n~n"
@@ -524,37 +523,6 @@ boot_error(Format, Args) ->
timer:sleep(1000),
exit({?MODULE, failure_during_boot}).
-
-diagnostics(Nodes) ->
- Hosts = lists:usort([element(2, rabbit_misc:nodeparts(Node)) ||
- Node <- Nodes]),
- NodeDiags = [{"~nDIAGNOSTICS~n===========~n~n"
- "nodes to contact: ~p~n~n"
- "hosts, their running nodes and ports:", [Nodes]}] ++
- [diagnostics_host(Host) || Host <- Hosts] ++
- diagnostics0(),
- lists:flatten([io_lib:format(F ++ "~n", A) || NodeDiag <- NodeDiags,
- {F, A} <- [NodeDiag]]).
-
-diagnostics0() ->
- [{"~ncurrent node details:~n- node name: ~w", [node()]},
- case init:get_argument(home) of
- {ok, [[Home]]} -> {"- home dir: ~s", [Home]};
- Other -> {"- no home dir: ~p", [Other]}
- end,
- {"- cookie hash: ~s", [rabbit_misc:cookie_hash()]}].
-
-diagnostics_host(Host) ->
- case net_adm:names(Host) of
- {error, EpmdReason} ->
- {"- unable to connect to epmd on ~s: ~w",
- [Host, EpmdReason]};
- {ok, NamePorts} ->
- {"- ~s: ~p",
- [Host, [{list_to_atom(Name), Port} ||
- {Name, Port} <- NamePorts]]}
- end.
-
format(F, A) -> lists:flatten(io_lib:format(F, A)).
%%---------------------------------------------------------------------------