summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_plugins.erl25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index 10906575f1..f5f249185f 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -418,16 +418,31 @@ remove_duplicate_plugins([Plugin|Rest], {Plugins0, Problems0}) ->
maybe_keep_required_deps(true, Plugins) ->
Plugins;
maybe_keep_required_deps(false, Plugins) ->
- %% We load the "rabbit" application to be sure we can get the
- %% "applications" key. This is required for rabbitmq-plugins for
- %% instance.
- application:load(rabbit),
- {ok, RabbitDeps} = application:get_key(rabbit, applications),
+ RabbitDeps = list_all_deps([rabbit]),
lists:filter(fun(#plugin{name = Name}) ->
not lists:member(Name, RabbitDeps)
end,
Plugins).
+list_all_deps(Applications) ->
+ list_all_deps(Applications, []).
+
+list_all_deps([Application | Applications], Deps) ->
+ %% We load the application to be sure we can get the "applications" key.
+ %% This is required for rabbitmq-plugins for instance.
+ application:load(Application),
+ NewDeps = [Application | Deps],
+ case application:get_key(Application, applications) of
+ {ok, ApplicationDeps} ->
+ RemainingApplications0 = ApplicationDeps ++ Applications,
+ RemainingApplications = RemainingApplications0 -- NewDeps,
+ list_all_deps(RemainingApplications, NewDeps);
+ undefined ->
+ list_all_deps(Applications, NewDeps)
+ end;
+list_all_deps([], Deps) ->
+ Deps.
+
remove_otp_overrideable_plugins(Plugins) ->
lists:filter(fun(P) -> not plugin_provided_by_otp(P) end,
Plugins).