summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sebastien Pedron <jean-sebastien@rabbitmq.com>2014-11-28 12:45:14 +0100
committerJean-Sebastien Pedron <jean-sebastien@rabbitmq.com>2014-11-28 12:45:14 +0100
commitd6798de8bf063780787c87dc7c0d934d27452cab (patch)
tree8b7bc7ec7552fdc5f76750d2cdbbb1df1b87b320
parent57d48705f822d41ca7f13b3c72c94f1b4dd7b91b (diff)
downloadrabbitmq-server-d6798de8bf063780787c87dc7c0d934d27452cab.tar.gz
No need to load/unload the plugin around the plugin_provided_by_otp/1 checkbug26265
While here, remove the unused PluginVsn variable.
-rw-r--r--src/rabbit_plugins.erl17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index 3aad48d1..dfde5289 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -102,7 +102,8 @@ list(PluginsDir) ->
_ -> rabbit_log:warning(
"Problem reading some plugins: ~p~n", [Problems])
end,
- Plugins = lists:filter(fun keep_plugin/1, AvailablePlugins),
+ Plugins = lists:filter(fun(P) -> not plugin_provided_by_otp(P) end,
+ AvailablePlugins),
ensure_dependencies(Plugins).
%% @doc Read the list of enabled plugins from the supplied term file.
@@ -135,19 +136,7 @@ dependencies(Reverse, Sources, AllPlugins) ->
%% For a few known cases, an externally provided plugin can be trusted.
%% In this special case, it overrides the plugin.
-keep_plugin(#plugin{name = App} = Plugin) ->
- case application:load(App) of
- {error, {already_loaded, _}} ->
- not plugin_provided_by_otp(Plugin);
- ok ->
- Ret = not plugin_provided_by_otp(Plugin),
- application:unload(App),
- Ret;
- _ ->
- true
- end.
-
-plugin_provided_by_otp(#plugin{name = eldap, version = PluginVsn}) ->
+plugin_provided_by_otp(#plugin{name = eldap}) ->
%% eldap was added to Erlang/OTP R15B01 (ERTS 5.9.1). In this case,
%% we prefer this version to the plugin.
rabbit_misc:version_compare(erlang:system_info(version), "5.9.1", gte);