diff options
| author | Daniil Fedotov <dfedotov@pivotal.io> | 2017-05-24 13:26:16 +0100 |
|---|---|---|
| committer | Daniil Fedotov <dfedotov@pivotal.io> | 2017-05-24 13:28:12 +0100 |
| commit | a440bc6c95a1a368f072877a6d1507a32e4776f7 (patch) | |
| tree | 2a915c5ec9e7e5cf7ee5f2d289770eb0620a6e65 /src | |
| parent | 993abe90bbc625e655d1d2e748b5af8559097db4 (diff) | |
| download | rabbitmq-server-git-a440bc6c95a1a368f072877a6d1507a32e4776f7.tar.gz | |
Format runtime parameters using info items
Runtime parameters list functions do not accept info items
as arguments. To return correct number and items order in the new CLI
parameters should be sorted by info items order.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_runtime_parameters.erl | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl index 82dea0bd7c..1b3cfb58c6 100644 --- a/src/rabbit_runtime_parameters.erl +++ b/src/rabbit_runtime_parameters.erl @@ -306,20 +306,32 @@ list_global() -> end). list_formatted(VHost) -> - [pset(value, rabbit_json:encode(pget(value, P)), P) || P <- list(VHost)]. + [ format_parameter(info_keys(), P) || P <- list(VHost) ]. + +format_parameter(InfoKeys, P) -> + lists:foldr(fun + (value, Acc) -> + [{value, rabbit_json:encode(pget(value, P))} | Acc]; + (Key, Acc) -> + case lists:keyfind(Key, 1, P) of + false -> Acc; + {Key, Val} -> [{Key, Val} | Acc] + end + end, + [], InfoKeys). list_formatted(VHost, Ref, AggregatorPid) -> rabbit_control_misc:emitting_map( AggregatorPid, Ref, - fun(P) -> pset(value, rabbit_json:encode(pget(value, P)), P) end, list(VHost)). + fun(P) -> format_parameter(info_keys(), P) end, list(VHost)). list_global_formatted() -> - [pset(value, rabbit_json:encode(pget(value, P)), P) || P <- list_global()]. + [ format_parameter(global_info_keys(), P) || P <- list_global() ]. list_global_formatted(Ref, AggregatorPid) -> rabbit_control_misc:emitting_map( AggregatorPid, Ref, - fun(P) -> pset(value, rabbit_json:encode(pget(value, P)), P) end, list_global()). + fun(P) -> format_parameter(global_info_keys(), P) end, list_global()). lookup(VHost, Component, Name) -> case lookup0({VHost, Component, Name}, rabbit_misc:const(not_found)) of |
