summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_plugins.erl19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index f07cff7231..f10e6536a9 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -307,15 +307,20 @@ plugins_cmp(#plugin{name = N1, version = V1},
#plugin{name = N2, version = V2}) ->
{N1, V1} =< {N2, V2}.
-%% Filter applications that can be loaded *right now*.
+%% Filter out applications that can be loaded *right now*.
filter_applications(Applications) ->
[Application || Application <- Applications,
- case application:load(Application) of
- {error, {already_loaded, _}} -> false;
- ok -> application:unload(Application),
- false;
- _ -> true
- end].
+ not is_available_app(Application)].
+
+%% Return whether is application is already available (and hence
+%% doesn't need enabling).
+is_available_app(Application) ->
+ case application:load(Application) of
+ {error, {already_loaded, _}} -> true;
+ ok -> application:unload(Application),
+ true;
+ _ -> false
+ end.
%% Return the names of the given plugins.
plugin_names(Plugins) ->