summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-10-11 14:23:21 +0100
committerSimon MacMullen <simon@rabbitmq.com>2011-10-11 14:23:21 +0100
commita0f8383025750f4df378c56802bcb86e2ad7b318 (patch)
tree0a9de948ffe2a590b6c5b91e5605b3f5115b8639
parent94f6c6df218f4377f71672b0184676f0c410a5a4 (diff)
downloadrabbitmq-server-a0f8383025750f4df378c56802bcb86e2ad7b318.tar.gz
If the user tries to enable a non-existent plugin, actually blow up and do nothing. Otherwise we end up with typos in the enabled_plugins file.
-rw-r--r--src/rabbit_plugins.erl14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index 902fd13d..2e005d5f 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -65,7 +65,7 @@ start() ->
print_error("~p", [Reason]),
rabbit_misc:quit(2);
Other ->
- print_error("~p", [Other]),
+ print_error("~s", [Other]),
rabbit_misc:quit(2)
end.
@@ -98,8 +98,8 @@ action(enable, ToEnable0, _Opts, PluginsFile, PluginsDir) ->
Missing = ToEnable -- plugin_names(AllPlugins),
case Missing of
[] -> ok;
- _ -> print_list("Warning: the following plugins could not be found:",
- Missing)
+ _ -> throw(fmt_list("The following plugins could not be found:",
+ Missing))
end,
NewEnabled = lists:usort(Enabled ++ ToEnable),
write_enabled_plugins(PluginsFile, NewEnabled),
@@ -280,9 +280,11 @@ format_plugin(#plugin{name = Name, version = Version,
end.
print_list(Header, Plugins) ->
- io:format("~s~n", [Header]),
- [io:format(" ~s~n", [P]) || P <- Plugins],
- io:format("~n").
+ io:format(fmt_list(Header, Plugins)).
+
+fmt_list(Header, Plugins) ->
+ lists:flatten(
+ [Header, $\n, [io_lib:format(" ~s~n", [P]) || P <- Plugins], $\n]).
usort_plugins(Plugins) ->
lists:usort(fun plugins_cmp/2, Plugins).