-
Notifications
You must be signed in to change notification settings - Fork 547
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
[kernelrt] Update options format for tuna #3392
Conversation
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. |
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
1 similar comment
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
sos/report/plugins/kernelrt.py
Outdated
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' |
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.
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'}"
)
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.
Ack, this looks really elegant. I'll make the change and push again.
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.
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!
04a546f
to
80a25e3
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.
Looks cleaner, just a style nitpick below.
sos/report/plugins/kernelrt.py
Outdated
self, pred=SoSPredicate(self, cmd_outputs=co) | ||
) | ||
self.add_cmd_output( | ||
f"tuna {'-CP' if option_present else 'show_threads -C'}" | ||
) |
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.
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 [...]"
)
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.
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]>
80a25e3
to
94178d3
Compare
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