summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-06-18 17:08:35 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-06-18 17:08:35 +0100
commitdc20aebe8e0b11b07ab1d04077395c15a1795869 (patch)
tree114f9896f92e9c696d1f9dd3a68cd96da7f749a9 /src
parent2bbd5a7e862e7c83471701b4dda4d639ad1d3f52 (diff)
downloadrabbitmq-server-git-dc20aebe8e0b11b07ab1d04077395c15a1795869.tar.gz
rabbitmq-plugins set.
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'"});