diff options
author | Tony Garnock-Jones <tonyg@lshift.net> | 2010-05-15 11:35:55 +1200 |
---|---|---|
committer | Tony Garnock-Jones <tonyg@lshift.net> | 2010-05-15 11:35:55 +1200 |
commit | 81496989afca9f4d771bedb5493bce0a9ac0209e (patch) | |
tree | 89a5f3cfec83eb77f963a62297a6f4d3af8dc73d | |
parent | c05ae22f463ce280bde92ab89c2d911c0e96730f (diff) | |
download | rabbitmq-server-81496989afca9f4d771bedb5493bce0a9ac0209e.tar.gz |
Warn, rather than die, on not-found module in boot step constructionbug22763
-rw-r--r-- | src/rabbit.erl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 67f8df94..c389178a 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -299,6 +299,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 +322,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). |