Skip to content

Commit 31dc3b8

Browse files
Definition export: filter out "undefined" DQT fields
1 parent 2e5cb21 commit 31dc3b8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

deps/rabbitmq_management/src/rabbit_mgmt_wm_definitions.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ all_definitions(ReqData, Context) ->
6363
{rabbitmq_version, rabbit_data_coercion:to_binary(Vsn)},
6464
{product_name, rabbit_data_coercion:to_binary(ProductName)},
6565
{product_version, rabbit_data_coercion:to_binary(ProductVersion)}] ++
66-
filter(
66+
retain_whitelisted(
6767
[{users, rabbit_mgmt_wm_users:users(all)},
6868
{vhosts, rabbit_mgmt_wm_vhosts:basic()},
6969
{permissions, rabbit_mgmt_wm_permissions:permissions()},
@@ -112,7 +112,7 @@ vhost_definitions(ReqData, VHost, Context) ->
112112
|| P <- rabbit_runtime_parameters:list(VHost)],
113113
rabbit_mgmt_util:reply(
114114
[{rabbit_version, rabbit_data_coercion:to_binary(Vsn)}] ++
115-
filter(
115+
retain_whitelisted(
116116
[{parameters, Parameters},
117117
{policies, [strip_vhost(P) || P <- rabbit_mgmt_wm_policies:basic(ReqData)]},
118118
{queues, Qs},
@@ -266,14 +266,14 @@ rw_state() ->
266266
{bindings, [source, vhost, destination, destination_type, routing_key,
267267
arguments]}].
268268

269-
filter(Items) ->
270-
[filter_items(N, V, proplists:get_value(N, rw_state())) || {N, V} <- Items].
269+
retain_whitelisted(Items) ->
270+
[retain_whitelisted_items(N, V, proplists:get_value(N, rw_state())) || {N, V} <- Items].
271271

272-
filter_items(Name, List, Allowed) ->
273-
{Name, [filter_item(I, Allowed) || I <- List]}.
272+
retain_whitelisted_items(Name, List, Allowed) ->
273+
{Name, [only_whitelisted_for_item(I, Allowed) || I <- List]}.
274274

275-
filter_item(Item, Allowed) ->
276-
[{K, Fact} || {K, Fact} <- Item, lists:member(K, Allowed)].
275+
only_whitelisted_for_item(Item, Allowed) ->
276+
[{K, Fact} || {K, Fact} <- Item, lists:member(K, Allowed), Fact =/= undefined].
277277

278278
strip_vhost(Item) ->
279279
lists:keydelete(vhost, 1, Item).

0 commit comments

Comments
 (0)