Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions deps/rabbit/src/rabbit_depr_ff_extra.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ cli_info0(DeprecatedFeature) ->

App = maps:get(provided_by, FeatureProps),
DeprecationPhase = maps:get(deprecation_phase, FeatureProps, ""),
State = maps:get(state, FeatureProps, ""),
Desc = maps:get(desc, FeatureProps, ""),
DocUrl = maps:get(doc_url, FeatureProps, ""),
Info = #{name => FeatureName,
desc => unicode:characters_to_binary(Desc),
deprecation_phase => DeprecationPhase,
state => State,
doc_url => unicode:characters_to_binary(DocUrl),
provided_by => App},
[Info | Acc]
Expand Down
13 changes: 10 additions & 3 deletions deps/rabbit/src/rabbit_deprecated_features.erl
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,16 @@ get_warning(FeatureProps, Permitted) when is_map(FeatureProps) ->
%% @returns A map of selected deprecated features.

list(all) ->
maps:filter(
fun(_, FeatureProps) -> ?IS_DEPRECATION(FeatureProps) end,
rabbit_ff_registry_wrapper:list(all));
maps:map(fun(FeatureName, FeatureProps) ->
FeatureProps#{state => case is_permitted_nolog(FeatureName)
of
true -> permitted;
false -> denied
end}
end,
maps:filter(
fun(_, FeatureProps) -> ?IS_DEPRECATION(FeatureProps) end,
rabbit_ff_registry_wrapper:list(all)));
list(used) ->
maps:filter(
fun(FeatureName, FeatureProps) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListDeprecatedFeaturesCommand do
@behaviour RabbitMQ.CLI.CommandBehaviour
use RabbitMQ.CLI.DefaultOutput

def formatter(), do: RabbitMQ.CLI.Formatters.Table
def formatter(), do: RabbitMQ.CLI.Formatters.PrettyTable

@info_keys ~w(name deprecation_phase provided_by desc doc_url)a
@info_keys ~w(name deprecation_phase state provided_by desc doc_url)a

def info_keys(), do: @info_keys

Expand All @@ -23,7 +23,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListDeprecatedFeaturesCommand do
def switches(), do: [used: :boolean]

def merge_defaults([], opts) do
{["name", "deprecation_phase"], Map.merge(%{used: false}, opts)}
{["name", "deprecation_phase", "state"], Map.merge(%{used: false}, opts)}
end

def merge_defaults(args, opts) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ defmodule ListDeprecatedFeaturesCommandTest do
@df1 => %{
desc: ~c"My deprecated feature #1",
provided_by: :ListDeprecatedFeaturesCommandTest,
deprecation_phase: :permitted_by_default
deprecation_phase: :permitted_by_default,
},
@df2 => %{
desc: ~c"My deprecated feature #2",
provided_by: :ListDeprecatedFeaturesCommandTest,
deprecation_phase: :removed
deprecation_phase: :removed,
}
}

Expand All @@ -47,8 +47,8 @@ defmodule ListDeprecatedFeaturesCommandTest do
]

full_result = [
[{:name, @df1}, {:deprecation_phase, :permitted_by_default}],
[{:name, @df2}, {:deprecation_phase, :removed}]
[{:name, @df1}, {:deprecation_phase, :permitted_by_default}, {:state, :permitted}],
[{:name, @df2}, {:deprecation_phase, :removed}, {:state, :denied}]
]

{
Expand All @@ -65,7 +65,7 @@ defmodule ListDeprecatedFeaturesCommandTest do
end

test "merge_defaults with no command, print just use the names" do
assert match?({["name", "deprecation_phase"], %{}}, @command.merge_defaults([], %{}))
assert match?({["name", "deprecation_phase", "state"], %{}}, @command.merge_defaults([], %{}))
end

test "validate: return bad_info_key on a single bad arg", context do
Expand Down Expand Up @@ -125,7 +125,7 @@ defmodule ListDeprecatedFeaturesCommandTest do

@tag test_timeout: 30000
test "run: sufficiently long timeouts don't interfere with results", context do
matches_found = @command.run(["name", "deprecation_phase"], context[:opts])
matches_found = @command.run(["name", "deprecation_phase", "state"], context[:opts])

assert Enum.all?(context[:full_result], fn feature_name ->
Enum.find(matches_found, fn found -> found == feature_name end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<tr>
<th><%= fmt_sort('Name', 'name') %></th>
<th><%= fmt_sort('Deprecation phase', 'deprecation_phase') %></th>
<th><%= fmt_sort('Current Configuration', 'state') %></th>
<th>Description</th>
</tr>
</thead>
Expand All @@ -43,6 +44,7 @@
<abbr class="status-<%= fmt_string(state_color) %>">In use</abbr>
<% } %>
<%= fmt_deprecation_phase(deprecated_feature.deprecation_phase, DEPRECATION_PHASES) %></td>
<td><%= fmt_string(deprecated_feature.state) %></td>
<td>
<p><%= fmt_string(deprecated_feature.desc) %></p>
<% if (deprecated_feature.doc_url) { %>
Expand Down
Loading