Skip to content
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

rabbitmq-plugins list: allow warnings to be suppressed #10865

Closed
wants to merge 5 commits into from

Conversation

Ayanda-D
Copy link
Contributor

@Ayanda-D Ayanda-D commented Mar 27, 2024

Proposed Changes

Some tools list plugins e.g. in json format, and can fail to decode output from missing plugins warning banner. We want to be able to optionally list plugins with no warning banner - avoiding any extra work on calling tools (e.g. in the case of sharing config files across new and legacy brokers). Example, with rabbitmq_unknown in enabled_plugins file:

with warning

ayanda@host$ rabbitmq-plugins list --formatter json
WARNING - plugins currently enabled but missing: rabbitmq_unknown

{"status":"running","format":"normal","plugins":[{"enabled":"not_enabled","name":"rabbitmq_amqp1_0","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_cache","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_http","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_ldap","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_oauth2","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_mechanism_ssl","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_consistent_hash_exchange","running":false,"version":[51,46,49

with no warning

ayanda@host$ rabbitmq-plugins list --formatter json --ignore-warnings
{"status":"running","format":"normal","plugins":[{"enabled":"not_enabled","name":"rabbitmq_amqp1_0","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_cache","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_http","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_ldap","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_backend_oauth2","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_auth_mechanism_ssl","running":false,"version":[51,46,49,50,46,56],"running_version":null},{"enabled":"not_enabled","name":"rabbitmq_consistent_hash_exchange","running":false,"version":[51,46,49

NOTE: --silent and --quiet options more for generic CommandBehaviour messages

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

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.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • If relevant, I have added necessary documentation to https://github.com/rabbitmq/rabbitmq-website
  • If relevant, I have added this change to the first version(s) in release-notes that I expect to introduce it

Further Comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc.

Copy link
Member

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only now noticed that the example uses --formatter=json.

For such cases, there are already --silent, --quiet and RabbitMQ.CLI.Core.Config.output_less?/1.

Instead of a new option, we can simply use RabbitMQ.CLI.Core.Config.output_less?/1 where ignore_warnings is used in this PR to ignore the warnings.

@michaelklishin michaelklishin changed the title List plugins with no warnings rabbitmq-plugins list: allow warnings to be suppressed Mar 27, 2024
michaelklishin added a commit that referenced this pull request Mar 27, 2024
michaelklishin added a commit that referenced this pull request Mar 27, 2024
michaelklishin added a commit that referenced this pull request Mar 27, 2024
@michaelklishin
Copy link
Member

See #10870.

michaelklishin added a commit that referenced this pull request Mar 28, 2024
mergify bot pushed a commit that referenced this pull request Mar 28, 2024
(cherry picked from commit c0187ec)
@Ayanda-D
Copy link
Contributor Author

Ayanda-D commented Mar 28, 2024

nice, reusing -s and -q better approach. I'd traced opts expecting --silent and --quiet to always be there, defaulting to false. didn't realise we already have RabbitMQ.CLI.Core.Config.output_less?/1 defaulting to false for both regardless (and expecting/merging these to user opts on the fly not breaking the flow) - good to know/learn for next time! 🙌

@michaelklishin Thank you!

@Ayanda-D Ayanda-D deleted the list-plugins-with-no-warning branch March 28, 2024 10:15
Ayanda-D added a commit to Ayanda-D/rabbitmq-server that referenced this pull request Mar 28, 2024
mergify bot pushed a commit that referenced this pull request Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants