summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-03-19 16:28:18 +0000
committerSimon MacMullen <simon@rabbitmq.com>2014-03-19 16:28:18 +0000
commit7866628eedbf92a14ebdda48e3786ccf25705071 (patch)
tree4764ff781bcc073e5f023d7cb840dde8ce16e4ca
parentc73380465ebeefb3d1d305646d9b3feda50898c6 (diff)
downloadrabbitmq-server-git-7866628eedbf92a14ebdda48e3786ccf25705071.tar.gz
UI tweak: look more like the output of dpkg, with two separate characters to indicate desired / actual status. Also refer to a plugin as being "running" rather than "active" since "active" and "enabled" might get confused.
-rw-r--r--docs/rabbitmq-plugins.1.xml18
-rw-r--r--src/rabbit_plugins_main.erl52
2 files changed, 38 insertions, 32 deletions
diff --git a/docs/rabbitmq-plugins.1.xml b/docs/rabbitmq-plugins.1.xml
index faa0bf41a1..3b67d0e6b3 100644
--- a/docs/rabbitmq-plugins.1.xml
+++ b/docs/rabbitmq-plugins.1.xml
@@ -97,16 +97,14 @@
</variablelist>
<para>
Lists all plugins, their versions, dependencies and
- descriptions. Each plugin is prefixed with a status
- indicator - [ ] to indicate that the plugin is not
- enabled, [E] to indicate that it is explicitly enabled,
- [e] to indicate that it is implicitly enabled, and [!] to
- indicate that it is enabled but missing and thus not
- operational. When a plugin is enabled but not currently
- active (i.e., running) in the currently targetted broker,
- [A] is shown, whilst a plugin which is active/running but
- not currently configured to be enabled is indicated by
- an [I].
+ descriptions. Each plugin is prefixed with two status
+ indicator characters inside [ ]. The first indicator can
+ be " " to indicate that the plugin is not enabled, "E" to
+ indicate that it is explicitly enabled, "e" to indicate
+ that it is implicitly enabled, or "!" to indicate that it
+ is enabled but missing and thus not operational. The
+ second indicator can be " " to show that the plugin is not
+ running, or "*" to show that it is.
</para>
<para>
If the optional pattern is given, only plugins whose
diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl
index e7475a684c..41d7072439 100644
--- a/src/rabbit_plugins_main.erl
+++ b/src/rabbit_plugins_main.erl
@@ -218,11 +218,11 @@ format_plugins(Node, Pattern, Opts, PluginsFile, PluginsDir) ->
AllEnabled = rabbit_plugins:dependencies(false, EnabledExplicitly,
AvailablePlugins),
EnabledImplicitly = AllEnabled -- EnabledExplicitly,
- ActivePlugins = case rpc:call(Node, rabbit_plugins, active,
- [], ?RPC_TIMEOUT) of
- {badrpc, _} -> AllEnabled;
- Active -> Active
- end,
+ Running = case rpc:call(Node, rabbit_plugins, active,
+ [], ?RPC_TIMEOUT) of
+ {badrpc, _} -> AllEnabled;
+ Active -> Active
+ end,
Missing = [#plugin{name = Name, dependencies = []} ||
Name <- ((EnabledExplicitly ++ EnabledImplicitly) --
plugin_names(AvailablePlugins))],
@@ -238,26 +238,34 @@ format_plugins(Node, Pattern, Opts, PluginsFile, PluginsDir) ->
Plugins1 = usort_plugins(Plugins),
MaxWidth = lists:max([length(atom_to_list(Name)) ||
#plugin{name = Name} <- Plugins1] ++ [0]),
- [format_plugin(P, EnabledExplicitly, EnabledImplicitly, ActivePlugins,
+ case Format of
+ minimal -> ok;
+ _ -> io:format(" Configured: E = explicitly enabled; "
+ "e = implicitly enabled; ! = missing~n"
+ " | Status: * = running on ~s~n"
+ " |/~n", [Node])
+ end,
+ [format_plugin(P, EnabledExplicitly, EnabledImplicitly, Running,
plugin_names(Missing), Format, MaxWidth) || P <- Plugins1],
ok.
format_plugin(#plugin{name = Name, version = Version,
description = Description, dependencies = Deps},
- EnabledExplicitly, EnabledImplicitly, Active,
+ EnabledExplicitly, EnabledImplicitly, Running,
Missing, Format, MaxWidth) ->
- Glyph = case {lists:member(Name, EnabledExplicitly),
- lists:member(Name, EnabledImplicitly),
- lists:member(Name, Missing),
- lists:member(Name, Active)} of
- {true, false, false, false} -> "[I]";
- {false, true, false, false} -> "[i]";
- {false, false, false, true} -> "[A]";
- {true, false, false, true} -> "[E]";
- {false, true, false, true} -> "[e]";
- {_, _, true, _} -> "[!]";
- _ -> "[ ]"
- end,
+ EnabledGlyph = case {lists:member(Name, EnabledExplicitly),
+ lists:member(Name, EnabledImplicitly),
+ lists:member(Name, Missing)} of
+ {true, false, false} -> "E";
+ {false, true, false} -> "e";
+ {_, _, true} -> "!";
+ _ -> " "
+ end,
+ RunningGlyph = case lists:member(Name, Running) of
+ true -> "*";
+ false -> " "
+ end,
+ Glyph = rabbit_misc:format("[~s~s]", [EnabledGlyph, RunningGlyph]),
Opt = fun (_F, A, A) -> ok;
( F, A, _) -> io:format(F, [A])
end,
@@ -268,9 +276,9 @@ format_plugin(#plugin{name = Name, version = Version,
Opt("~s", Version, undefined),
io:format("~n");
verbose -> io:format("~s ~w~n", [Glyph, Name]),
- Opt(" Version: \t~s~n", Version, undefined),
- Opt(" Dependencies:\t~p~n", Deps, []),
- Opt(" Description: \t~s~n", Description, undefined),
+ Opt(" Version: \t~s~n", Version, undefined),
+ Opt(" Dependencies:\t~p~n", Deps, []),
+ Opt(" Description: \t~s~n", Description, undefined),
io:format("~n")
end.