Add metadata for vhosts in global definitions exported via UI#11454
Add metadata for vhosts in global definitions exported via UI#11454anhanhnguyen wants to merge 3 commits into
Conversation
|
The limit code part remains untouched.
The behaviours of @michaelklishin Please confirm if limits and |
a2f6d70 to
29de365
Compare
|
The forced push was a rebase. |
|
@anhanhnguyen I will have to take a look at what the behavior of the virtual host-specific exporting endpoint is, and how it compares to CLI tools. I will get back to you next week. |
29de365 to
2dbb90f
Compare
michaelklishin
left a comment
There was a problem hiding this comment.
This breaks HTTP API tests:
gmake ct-rabbit_mgmt_httpor, with Bazel
bt //deps/rabbitmq_management:rabbit_mgmt_http_SUITE
bt //deps/rabbitmq_management:rabbit_mgmt_http_SUITE-mixed
in the definition import test immediately reveals an exception. Looks like this is the relevant part: |
| binary_to_list(Filename), ReqData) | ||
| end, | ||
| Context). | ||
| rabbit_definitions:all_definitions(), |
There was a problem hiding this comment.
This function can return keys that the HTTP API cannot serialize to JSON as is.
Which is why this filtering exists in the same module:
rw_state() ->
[{users, [name, password_hash, hashing_algorithm, tags, limits]},
{vhosts, [name]},
{permissions, [user, vhost, configure, write, read]},
{topic_permissions, [user, vhost, exchange, write, read]},
{parameters, [vhost, component, name, value]},
{global_parameters, [name, value]},
{policies, [vhost, name, pattern, definition, priority, 'apply-to']},
{queues, [name, vhost, durable, auto_delete, arguments]},
{exchanges, [name, vhost, type, durable, auto_delete, internal,
arguments]},
{bindings, [source, vhost, destination, destination_type, routing_key,
arguments]}].
filter(Items) ->
[filter_items(N, V, proplists:get_value(N, rw_state())) || {N, V} <- Items].|
I'm afraid I cannot accept this pull request as is. It breaks the HTTP API by removing the filtering and assuming that anything returned by It hijacks an existing test to test something different then uses dummy values such as an empty list of tags and an empty description string. Using an empty list of tags specifically won't test much. The implementation part should have been diff --git a/deps/rabbitmq_management/src/rabbit_mgmt_wm_definitions.erl b/deps/rabbitmq_management/src/rabbit_mgmt_wm_definitions.erl
index 06f98b1408..65c833450f 100644
--- a/deps/rabbitmq_management/src/rabbit_mgmt_wm_definitions.erl
+++ b/deps/rabbitmq_management/src/rabbit_mgmt_wm_definitions.erl
@@ -254,7 +254,7 @@ export_name(_Name) -> true.
rw_state() ->
[{users, [name, password_hash, hashing_algorithm, tags, limits]},
- {vhosts, [name]},
+ {vhosts, [name, description, tags, default_queue_type, metadata]},
{permissions, [user, vhost, configure, write, read]},
{topic_permissions, [user, vhost, exchange, write, read]},
{parameters, [vhost, component, name, value]},
diff --git a/deps/rabbitmq_management/src/rabbit_mgmt_wm_vhosts.erl b/deps/rabbitmq_management/src/rabbit_mgmt_wm_vhosts.erl
index 2decdfc9ed..a0779a2af3 100644
--- a/deps/rabbitmq_management/src/rabbit_mgmt_wm_vhosts.erl
+++ b/deps/rabbitmq_management/src/rabbit_mgmt_wm_vhosts.erl
@@ -55,7 +55,7 @@ augment(Basic, ReqData) ->
augmented(ReqData, #context{user = User}) ->
case rabbit_mgmt_util:disable_stats(ReqData) of
- false ->
+ false ->
rabbit_mgmt_db:augment_vhosts(
[rabbit_vhost:info(V) || V <- rabbit_mgmt_util:list_visible_vhosts(User)],
rabbit_mgmt_util:range(ReqData));
@@ -64,4 +64,4 @@ augmented(ReqData, #context{user = User}) ->
end.
basic() ->
- rabbit_vhost:info_all([name]).
+ rabbit_vhost:info_all([name, description, tags, default_queue_type, metadata]).and a new test should have been added to test the metadata specifically. |
Proposed Changes
Fix the issue reported at #10515.
Types of Changes
What types of changes does your code introduce to this project?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply.You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.
CONTRIBUTING.mddocumentFurther Comments
The change aims to synchronise the output of
GET /api/definitionsandrabbitmqctl export_definitionsrabbit_definitions:all_definitions()asrabbitmqctl export_definitionsdefinition_import_SUITEand its input cases are covered