summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-06-18 17:10:44 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-06-18 17:10:44 +0100
commitad47331ebb7b9fde0a8cc4c69ad119ffbfe052d9 (patch)
treeaf213a1169a6e0314c9a66ddd09eb2dcde050cb7 /src
parent2bbd5a7e862e7c83471701b4dda4d639ad1d3f52 (diff)
parentfe20643701ecc350293810a0937861f92948e7e1 (diff)
downloadrabbitmq-server-git-ad47331ebb7b9fde0a8cc4c69ad119ffbfe052d9.tar.gz
Merge bug25446
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_plugins_main.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl
index a3f12c96c8..7e9c4d60a9 100644
--- a/src/rabbit_plugins_main.erl
+++ b/src/rabbit_plugins_main.erl
@@ -44,6 +44,7 @@
[{list, [?VERBOSE_DEF, ?MINIMAL_DEF, ?ENABLED_DEF, ?ENABLED_ALL_DEF]},
{enable, [?OFFLINE_DEF, ?ONLINE_DEF]},
{disable, [?OFFLINE_DEF, ?ONLINE_DEF]},
+ {set, [?OFFLINE_DEF, ?ONLINE_DEF]},
{sync, []}]).
%%----------------------------------------------------------------------------
@@ -157,6 +158,27 @@ action(enable, Node, ToEnable0, Opts, PluginsFile, PluginsDir) ->
action_change(
Opts, Node, ImplicitlyEnabled, NewImplicitlyEnabled, PluginsFile);
+action(set, Node, ToSet0, Opts, PluginsFile, PluginsDir) ->
+ ToSet = [list_to_atom(Name) || Name <- ToSet0],
+ AllPlugins = rabbit_plugins:list(PluginsDir),
+ Enabled = rabbit_plugins:read_enabled(PluginsFile),
+ ImplicitlyEnabled = rabbit_plugins:dependencies(false, Enabled, AllPlugins),
+ Missing = ToSet -- plugin_names(AllPlugins),
+ case Missing of
+ [] -> ok;
+ _ -> throw({error_string, fmt_missing(Missing)})
+ end,
+ NewImplicitlyEnabled = rabbit_plugins:dependencies(false,
+ ToSet, AllPlugins),
+ write_enabled_plugins(PluginsFile, ToSet),
+ case NewImplicitlyEnabled of
+ [] -> io:format("All plugins are now disabled.~n");
+ _ -> print_list("The following plugins are now enabled:",
+ NewImplicitlyEnabled)
+ end,
+ action_change(
+ Opts, Node, ImplicitlyEnabled, NewImplicitlyEnabled, PluginsFile);
+
action(disable, Node, ToDisable0, Opts, PluginsFile, PluginsDir) ->
case ToDisable0 of
[] -> throw({error_string, "Not enough arguments for 'disable'"});