-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metadata for vhosts in global definitions exported via UI #11454
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks HTTP API tests:
gmake ct-rabbit_mgmt_http
or, 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
x
in the boxes that applyChecklist
Put an
x
in 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.md
documentFurther Comments
The change aims to synchronise the output of
GET /api/definitions
andrabbitmqctl export_definitions
rabbit_definitions:all_definitions()
asrabbitmqctl export_definitions
definition_import_SUITE
and its input cases are covered