feat: add ui parameter to all add_info functions#561
Merged
bdrung merged 1 commit intocanonical:mainfrom Mar 30, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #561 +/- ##
=======================================
Coverage 84.42% 84.42%
=======================================
Files 104 104
Lines 20910 20910
Branches 3275 3275
=======================================
Hits 17653 17653
- Misses 2817 2818 +1
+ Partials 440 439 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
06798ee to
4f07f1d
Compare
`_run_hook` calls the `add_info` functions with two parameters and falls back to one parameter for backward compatibility. So add the second `ui` parameter to all `add_info` functions. This will make reading tracebacks easier (since the fallback will not be in the trace then). Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Hyask
approved these changes
Mar 30, 2026
Contributor
Hyask
left a comment
There was a problem hiding this comment.
LGTM, but some additional context wouldn't hurt in the PR description in the form of a traceback before and after.
Member
Author
|
I don't remember where I saw it, but the relevant calling code is: def _run_hook(report, ui, hook):
if not os.path.exists(hook):
return False
symb = {}
try:
with open(hook, encoding="utf-8") as fd:
# legacy, pylint: disable=exec-used
exec(compile(fd.read(), hook, "exec"), symb)
try:
symb["add_info"](report, ui)
except TypeError as error:
if str(error).startswith("add_info()"):
# older versions of apport did not pass UI, and hooks that
# do not require it don't need to take it
symb["add_info"](report)
else:
raise |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_run_hookcalls theadd_infofunctions with two parameters and falls back to one parameter for backward compatibility. So add the seconduiparameter to alladd_infofunctions. This will make reading tracebacks easier (since the fallback will not be in the trace then).