-
Notifications
You must be signed in to change notification settings - Fork 196
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
Improve debian reposync logging (bsc#1227859) #9705
base: master
Are you sure you want to change the base?
Conversation
Since all loggers in the logging library inherit the config from their parents up to the root logger, we can use the root logger similarly to rhnLog's LOG object. The root logger singleton is changed to direct the log messages to the same log file with a similar log level as LOG.
efa3ad8
to
52f4ad7
Compare
# pylint: disable-next=logging-fstring-interpolation | ||
logger.error(f"{DpkgRepo.GPG_VERIFICATION_FAILED}: {release_file}") |
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.
Can we fix this completely?
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.
This should be equivalent and should pass the linting error (f-strings are eagerly evaluated, which is why they are discouraged in logging, since logging may never fire)
# pylint: disable-next=logging-fstring-interpolation | |
logger.error(f"{DpkgRepo.GPG_VERIFICATION_FAILED}: {release_file}") | |
logger.error("%s: %s", DpkgRepo.GPG_VERIFICATION_FAILED, release_file) |
@@ -309,15 +309,15 @@ def _exit(): | |||
atexit.register(_exit) | |||
|
|||
|
|||
def log_level_to_logging_constant(rhnLog_log_level: int): | |||
def log_level_to_logging_constant(rhnlog_log_level: int): |
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.
rhnLog
is still called rhnLog
, the name was chosen on purpose to reflect that.
# Apparently we need to call initCFG and have CFG available | ||
# to prevent some errors accessing CFG later on during package | ||
# import. | ||
initCFG("server.satellite") |
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.
Can we please fix this as well? I'm okay with doing it in another PR, as we already have the patch we shouldn't leave it lying around until it does not apply anymore.
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.
You're adding a lot of pylint disable comments. What's the plan for those?
What does this PR change?
This PR refactors and enhances logging around debian reposync executions.
GUI diff
No difference.
Documentation
No documentation needed: only internal and user invisible changes
DONE
Test coverage
No tests: no tests around reposync logging
DONE
Links
Issue(s): https://github.com/SUSE/spacewalk/issues/24816
Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
If you uncheck the checkbox after the PR is created, you will need to re-run
changelog_test
(see below)Re-run a test
If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:
Before you merge
Check How to branch and merge properly!