diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-29 18:06:34 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-29 18:06:34 +0100 |
commit | dd63fc07ac94f7a7d554ee319e7e8ecdb2fb780f (patch) | |
tree | 404ed274e550cce7fbbd98c44aec77d84a526c98 | |
parent | 09c8f9f2665333ac839e4cc80afe1718a36211db (diff) | |
download | rabbitmq-server-dd63fc07ac94f7a7d554ee319e7e8ecdb2fb780f.tar.gz |
refactor
-rw-r--r-- | src/rabbit_plugins.erl | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index f07cff72..f10e6536 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) -> |