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

[Plugins, Options] Standardize PluginOpt names to use dashes #3636

Merged
merged 1 commit into from May 13, 2024

Conversation

TurboTurtle
Copy link
Member

This commit standardizes the use of dashes/hypens (-) for the names of PluginOpts. This is done to conform with argparse formatting so that the formating of options names is consistent across sos global options, component options, and now plugin options.

For example, the networking plugin's namespace_pattern option is now namespace-pattern and should now be specified via the --plugin-option networking.namespace-pattern=foo syntax. Similarly, developers will now need to use Plugin.get_option('namespace-pattern') in order to reference it.

Note that the use of global options within plugins (for example --all-logs) is unchanged, meaning that users will continue to use --all-logs and due to how these options get stored, developers would still use Plugin.get_option('all_logs').


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

This commit standardizes the use of dashes/hypens (`-`) for the names of
PluginOpts. This is done to conform with argparse formatting so that the
formating of options names is consistent across sos global options,
component options, and now plugin options.

For example, the `networking` plugin's `namespace_pattern` option is now
`namespace-pattern` and should now be specified via the `--plugin-option
networking.namespace-pattern=foo` syntax. Similarly, developers will now
need to use `Plugin.get_option('namespace-pattern')` in order to
reference it.

Note that the use of global options within plugins (for example
`--all-logs`) is unchanged, meaning that users will continue to use
`--all-logs` and due to how these options get stored, developers would
still use `Plugin.get_option('all_logs')`.

Signed-off-by: Jake Hunsaker <jacob.r.hunsaker@gmail.com>
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3636
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@TurboTurtle
Copy link
Member Author

As mentioned, this is done purely to create a consistent CLI experience for users, and I landed on converting to dashes from underscores rather than the other way around simply because our "top level" CLI options that are handled by argparse are exclusively dashes.

Happy to hear any arguments for moving the other way, though that would be a much larger shift.

The handling of global options that affect plugins (e.g. --all-logs) that get converted to underscores internally by necessity of the Python language when trying to get their value is the schism here for developers. We could add a conversion in get_option() that allows one to use get_option('all-logs') but since it hasn't been an issue for devels up to this point, I didn't go forward with that (again, this change is mainly focused on end user usage).

@TurboTurtle TurboTurtle changed the title [Plugins, Options] Standardized PluginOpt names to use dashes [Plugins, Options] Standardize PluginOpt names to use dashes May 7, 2024
Copy link
Member

@arif-ali arif-ali left a comment

Choose a reason for hiding this comment

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

I'm on par with that, make all the things consistent

@TurboTurtle
Copy link
Member Author

Note to self: after merging, update the contributions guideline to include a line about this.

Copy link
Contributor

@pmoravec pmoravec left a comment

Choose a reason for hiding this comment

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

Ack, though we shall (how?) warn users about the plugin opts syntax change.

Cc @mhradile for awareness.

@TurboTurtle
Copy link
Member Author

Ack, though we shall (how?) warn users about the plugin opts syntax change.

Cc @mhradile for awareness.

Release notes are the standard track for that. We can make sure to be loud about it.

@TurboTurtle TurboTurtle merged commit 00a7f9a into sosreport:main May 13, 2024
39 checks passed
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

3 participants