Skip to content

Commit 12a7f34

Browse files
michaelklishinmergify[bot]
authored andcommitted
Remove a Shovel JSON formatting function that's no longer necessary
It's been eight years since 28060d5 (cherry picked from commit d3ea758) (cherry picked from commit 5620dd9)
1 parent 54ead1c commit 12a7f34

File tree

4 files changed

+4
-26
lines changed

4 files changed

+4
-26
lines changed

deps/rabbitmq_management/src/rabbit_mgmt_wm_definitions.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ vhost_definitions(ReqData, VHost, Context) ->
107107
export_binding(B, QNames)],
108108
{ok, Vsn} = application:get_key(rabbit, vsn),
109109
Parameters = [strip_vhost(
110-
rabbit_mgmt_format:parameter(
111-
rabbit_mgmt_wm_parameters:fix_shovel_publish_properties(P)))
110+
rabbit_mgmt_format:parameter(P))
112111
|| P <- rabbit_runtime_parameters:list(VHost)],
113112
rabbit_mgmt_util:reply(
114113
[{rabbit_version, rabbit_data_coercion:to_binary(Vsn)}] ++

deps/rabbitmq_management/src/rabbit_mgmt_wm_parameter.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ resource_exists(ReqData, Context) ->
4040
end, ReqData, Context}.
4141

4242
to_json(ReqData, Context) ->
43-
rabbit_mgmt_util:reply(rabbit_mgmt_format:parameter(
44-
rabbit_mgmt_wm_parameters:fix_shovel_publish_properties(parameter(ReqData))),
43+
rabbit_mgmt_util:reply(rabbit_mgmt_format:parameter(parameter(ReqData)),
4544
ReqData, Context).
4645

4746
accept_content(ReqData0, Context = #context{user = User}) ->

deps/rabbitmq_management/src/rabbit_mgmt_wm_parameters.erl

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
-export([init/2, to_json/2, content_types_provided/2, is_authorized/2,
1111
resource_exists/2, basic/1]).
12-
-export([fix_shovel_publish_properties/1]).
1312
-export([variances/2]).
1413

1514
-include_lib("rabbitmq_management_agent/include/rabbit_mgmt_records.hrl").
@@ -42,24 +41,6 @@ is_authorized(ReqData, Context) ->
4241

4342
%%--------------------------------------------------------------------
4443

45-
%% Hackish fix to make sure we return a JSON object instead of an empty list
46-
%% when the publish-properties value is empty.
47-
fix_shovel_publish_properties(P) ->
48-
case lists:keyfind(component, 1, P) of
49-
{_, <<"shovel">>} ->
50-
case lists:keytake(value, 1, P) of
51-
{value, {_, Values}, P2} ->
52-
case lists:keytake(<<"publish-properties">>, 1, Values) of
53-
{_, {_, []}, Values2} ->
54-
P2 ++ [{value, Values2 ++ [{<<"publish-properties">>, empty_struct}]}];
55-
_ ->
56-
P
57-
end;
58-
_ -> P
59-
end;
60-
_ -> P
61-
end.
62-
6344
basic(ReqData) ->
6445
Raw = case rabbit_mgmt_util:id(component, ReqData) of
6546
none -> rabbit_runtime_parameters:list();
@@ -73,5 +54,5 @@ basic(ReqData) ->
7354
end,
7455
case Raw of
7556
not_found -> not_found;
76-
_ -> [rabbit_mgmt_format:parameter(fix_shovel_publish_properties(P)) || P <- Raw]
57+
_ -> [rabbit_mgmt_format:parameter(P) || P <- Raw]
7758
end.

deps/rabbitmq_shovel_management/src/rabbit_shovel_mgmt_shovel.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ resource_exists(ReqData, Context) ->
6666

6767
to_json(ReqData, Context) ->
6868
Shovel = parameter(ReqData),
69-
rabbit_mgmt_util:reply(rabbit_mgmt_format:parameter(
70-
rabbit_mgmt_wm_parameters:fix_shovel_publish_properties(Shovel)),
69+
rabbit_mgmt_util:reply(rabbit_mgmt_format:parameter(Shovel),
7170
ReqData, Context).
7271

7372
is_authorized(ReqData, Context) ->

0 commit comments

Comments
 (0)