summaryrefslogtreecommitdiff
path: root/src/rabbit.erl
diff options
context:
space:
mode:
authorVlad Ionescu <vlad@rabbitmq.com>2010-07-14 18:28:23 +0100
committerVlad Ionescu <vlad@rabbitmq.com>2010-07-14 18:28:23 +0100
commit7549aa28632606b314c4f2371900320a5a18d0d9 (patch)
tree6c382f61e2c2a1686b8c4fa8321c0f4c6469727f /src/rabbit.erl
parentba24177421fecdfb30defb32b46268b1ba60cfcb (diff)
parent507610f99444e187ed7d2c6216d2bbbd0325c138 (diff)
downloadrabbitmq-server-git-7549aa28632606b314c4f2371900320a5a18d0d9.tar.gz
merging in from default
Diffstat (limited to 'src/rabbit.erl')
-rw-r--r--src/rabbit.erl30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 67f8df947b..18045b94fc 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -33,7 +33,8 @@
-behaviour(application).
--export([prepare/0, start/0, stop/0, stop_and_halt/0, status/0, rotate_logs/1]).
+-export([prepare/0, start/0, stop/0, stop_and_halt/0, status/0,
+ rotate_logs/1]).
-export([start/2, stop/1]).
@@ -183,18 +184,19 @@
-ifdef(use_specs).
--type(log_location() :: 'tty' | 'undefined' | string()).
-type(file_suffix() :: binary()).
+%% this really should be an abstract type
+-type(log_location() :: 'tty' | 'undefined' | file:filename()).
-spec(prepare/0 :: () -> 'ok').
-spec(start/0 :: () -> 'ok').
-spec(stop/0 :: () -> 'ok').
-spec(stop_and_halt/0 :: () -> 'ok').
--spec(rotate_logs/1 :: (file_suffix()) -> 'ok' | {'error', any()}).
--spec(status/0 :: () ->
- [{running_applications, [{atom(), string(), string()}]} |
- {nodes, [erlang_node()]} |
- {running_nodes, [erlang_node()]}]).
+-spec(rotate_logs/1 :: (file_suffix()) -> rabbit_types:ok_or_error(any())).
+-spec(status/0 ::
+ () -> [{running_applications, [{atom(), string(), string()}]} |
+ {nodes, [{rabbit_mnesia:node_type(), [node()]}]} |
+ {running_nodes, [node()]}]).
-spec(log_location/1 :: ('sasl' | 'kernel') -> log_location()).
-endif.
@@ -299,6 +301,18 @@ run_boot_step({StepName, Attributes}) ->
ok
end.
+module_attributes(Module) ->
+ case catch Module:module_info(attributes) of
+ {'EXIT', {undef, [{Module, module_info, _} | _]}} ->
+ io:format("WARNING: module ~p not found, so not scanned for boot steps.~n",
+ [Module]),
+ [];
+ {'EXIT', Reason} ->
+ exit(Reason);
+ V ->
+ V
+ end.
+
boot_steps() ->
AllApps = [App || {App, _, _} <- application:loaded_applications()],
Modules = lists:usort(
@@ -310,7 +324,7 @@ boot_steps() ->
lists:flatmap(fun (Module) ->
[{StepName, Attributes}
|| {rabbit_boot_step, [{StepName, Attributes}]}
- <- Module:module_info(attributes)]
+ <- module_attributes(Module)]
end, Modules),
sort_boot_steps(UnsortedSteps).