diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-11-23 10:48:57 +0100 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-11-23 10:48:57 +0100 |
| commit | 3c1588167e5cf4ceea5c2b4c4e47fa50e6998541 (patch) | |
| tree | 26af4b460d34bba1abae31dc2bf73daa505368f7 /src | |
| parent | a5bd8bd35f72d504ba331648c109a7281d1586aa (diff) | |
| download | rabbitmq-server-git-3c1588167e5cf4ceea5c2b4c4e47fa50e6998541.tar.gz | |
Applications being required by RabbitMQ can't be plugins
This replaces the hard-coded "rabbit_common", now that "ranch" is also a
required application.
The goal is the same: we don't want to list requirements as plugins.
Otherwise, the user could thnk he can disable them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_plugins.erl | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index 84828e018f..299e5e7351 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -90,13 +90,24 @@ list(PluginsDir) -> EZs = [{ez, EZ} || EZ <- filelib:wildcard("*.ez", PluginsDir)], FreeApps = [{app, App} || App <- filelib:wildcard("*/ebin/*.app", PluginsDir)], + %% 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), {AvailablePlugins, Problems} = lists:foldl(fun ({error, EZ, Reason}, {Plugins1, Problems1}) -> {Plugins1, [{EZ, Reason} | Problems1]}; - (#plugin{name = rabbit_common}, {Plugins1, Problems1}) -> - {Plugins1, Problems1}; - (Plugin = #plugin{}, {Plugins1, Problems1}) -> - {[Plugin|Plugins1], Problems1} + (Plugin = #plugin{name = Name}, {Plugins1, Problems1}) -> + %% Applications RabbitMQ depends on (eg. + %% "rabbit_common") can't be considered + %% plugins, otherwise rabbitmq-plugins would + %% list them and the user may believe he can + %% disable them. + case lists:member(Name, RabbitDeps) of + false -> {[Plugin|Plugins1], Problems1}; + true -> {Plugins1, Problems1} + end end, {[], []}, [plugin_info(PluginsDir, Plug) || Plug <- EZs ++ FreeApps]), case Problems of |
