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

[kernelrt] Update options format for tuna #3392

Merged

Conversation

jcastill
Copy link
Member

In newer versions of tuna, the option -P has been
substituted for 'show_threads'.
Test if the new option is present in 'tuna --help' and if so, use it.

Closes: RH SUPDEV-150


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 protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?

@jcastill
Copy link
Member Author

The change in the option names and format happened in RHEL 9, in 0.18-7. Unfortunately using --version only shows 0.18, so the only way to make sure the option is there is to mimic what we did in the grub2 plugin, i.e. get the output of --help and see if the new option name is listed.
This should not affect Ubuntu since there we have up to 0.15-1, if I'm not mistaken.

@packit-as-a-service
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-3392
  • And now you can install the packages.

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

1 similar comment
@packit-as-a-service
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-3392
  • And now you can install the packages.

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

Comment on lines 40 to 44
co = {'cmd': '%s --help' % tuna_cmd, 'output': 'show_threads'}
if self.test_predicate(self, pred=SoSPredicate(self, cmd_outputs=co)):
tuna_cmd += ' show_threads -C'
else:
tuna_cmd += ' -CP'
Copy link
Member

Choose a reason for hiding this comment

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

Ack to the intent, but we're trying to move off of legacy string interpolation methods and to f-strings globally. We could do this and button it up a bit with something like:

co = {'cmd': 'tuna --help', 'output': 'show_threads'}
self.add_cmd_output(
    f"tuna {'show_threads -C' if bool(SosPredicate(self, cmd_outputs=co)) else 'CP'}"
)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack, this looks really elegant. I'll make the change and push again.

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the predicate test outside of the f-string because when I tried to break the curly braces and couldn't find a clean way. As always, any suggestion is welcome!

@jcastill jcastill force-pushed the jcastillo-fix-tuna-capture-options branch from 04a546f to 80a25e3 Compare October 26, 2023 09:49
Copy link
Member

@TurboTurtle TurboTurtle left a comment

Choose a reason for hiding this comment

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

Looks cleaner, just a style nitpick below.

Comment on lines 41 to 45
self, pred=SoSPredicate(self, cmd_outputs=co)
)
self.add_cmd_output(
f"tuna {'-CP' if option_present else 'show_threads -C'}"
)
Copy link
Member

Choose a reason for hiding this comment

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

Style nit: sos-style is single indention and the closing paren on the same line as the caller, e.g.:

self.add_cmd_output(
    f"tuna [...]"
)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack, done!

In newer versions of tuna, the option -P has been
substituted for 'show_threads'.
Test if the new option is present in 'tuna --help'
and if so, use it.

Closes: RH SUPDEV-150

Signed-off-by: Jose Castillo <[email protected]>
@jcastill jcastill force-pushed the jcastillo-fix-tuna-capture-options branch from 80a25e3 to 94178d3 Compare November 4, 2023 21:08
@TurboTurtle TurboTurtle merged commit b7a0aff into sosreport:main Nov 6, 2023
30 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.

3 participants