diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-10-26 14:15:50 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-10-26 14:15:50 +0100 |
commit | da82e950ea979347b67cf73ac9abe497c9068b38 (patch) | |
tree | 8ac86d4bae30f542edbaa8b5dc104ec173a2e163 | |
parent | 3b059d1d73a489fe80c05a2aeeb7384a738badd7 (diff) | |
download | rabbitmq-server-da82e950ea979347b67cf73ac9abe497c9068b38.tar.gz |
we can have both missing plugins and missing dependencies
-rw-r--r-- | src/rabbit_plugins_main.erl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl index b5429620..50c49229 100644 --- a/src/rabbit_plugins_main.erl +++ b/src/rabbit_plugins_main.erl @@ -111,15 +111,14 @@ action(enable, ToEnable0, _Opts, PluginsFile, PluginsDir) -> NewEnabled = lists:usort(Enabled ++ ToEnable), NewImplicitlyEnabled = rabbit_plugins:dependencies(false, NewEnabled, AllPlugins), - MissingDeps = NewImplicitlyEnabled -- plugin_names(AllPlugins), + MissingDeps = (NewImplicitlyEnabled -- plugin_names(AllPlugins)) -- Missing, case {Missing, MissingDeps} of {[], []} -> ok; - {Miss, []} -> throw({error_string, - fmt_list("The following plugins " - "could not be found:", Miss)}); - {[], Miss} -> throw({error_string, - fmt_list("The following plugin dependencies " - "could not be found:", Miss)}) + {Miss, []} -> throw({error_string, fmt_missing("plugins", Miss)}); + {[], Miss} -> throw({error_string, fmt_missing("dependencies", Miss)}); + {_, _} -> throw({error_string, + fmt_missing("plugins", Missing) ++ + fmt_missing("dependencies", MissingDeps)}) end, write_enabled_plugins(PluginsFile, NewEnabled), maybe_warn_mochiweb(NewImplicitlyEnabled), @@ -240,6 +239,9 @@ fmt_list(Header, Plugins) -> lists:flatten( [Header, $\n, [io_lib:format(" ~s~n", [P]) || P <- Plugins]]). +fmt_missing(Desc, Missing) -> + fmt_list("The following " ++ Desc ++ " could not be found:", Missing). + usort_plugins(Plugins) -> lists:usort(fun plugins_cmp/2, Plugins). |