Avoid root logger setup when SELinux helper is missing#30
Open
coiby wants to merge 1 commit into
Open
Conversation
When testcloud's has_selinux() runs on systems where the selinuxenabled
command is not installed. The FileNotFoundError handler used
module-level logging.debug(), which implicitly calls
logging.basicConfig() when the root logger has no handlers.
That creates a default root StreamHandler. Libraries such as tmt use
propagating DEBUG-level loggers with their own filtering, so once the
root handler exists, their records also get emitted with Python's
default format which clutters CI output e.g. [1],
/plans/example
discover
how: shell
summary: 1 test selected
provision
queued provision.provision tasks
teemtee#1: default-0
provision.provision task teemtee#1: default-0
how: virtual
ansible: {}
image: fedora:43
progress: downloading...
DEBUG:tmt.run.logger0.provision.provision.queue: Run command: qemu-img check /var/tmp/tmt/testcloud/images/Fedora-Cloud-Base-Generic-43-1.6.x86_64.qcow2
DEBUG:tmt.run.logger0.provision.provision.queue: environment: {}
DEBUG:tmt.run.logger0.provision.provision.queue: Command event: 2.674e-06 waiting for process to finish
DEBUG:tmt.run.logger0.provision.provision.queue: stdout: No errors were found on the image.
DEBUG:tmt.run.logger0.provision.provision.queue: stdout: 11441/81920 = 13.97% allocated, 91.29% fragmented, 88.97% compressed clusters
DEBUG:tmt.run.logger0.provision.provision.queue: stdout: Image end offset: 583335936
DEBUG:tmt.run.logger0.provision.provision.queue: Command event: 0.00551 waiting for process completed
DEBUG:tmt.run.logger0.provision.provision.queue: Command event: 0.00559 waiting for stream readers
....
Log through the testcloud.util module logger instead, preserving the
existing library-mode NullHandler behavior and avoiding implicit root
logger configuration. Add a regression test for the missing
selinuxenabled path.
[1] https://github.com/coiby/kernel-auto-bisect/actions/runs/27798088731/job/82262170969?pr=5
Assisted-by: Codex:gpt-5.5
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.
When testcloud's has_selinux() runs on systems where the selinuxenabled command is not installed. The FileNotFoundError handler used module-level logging.debug(), which implicitly calls logging.basicConfig() when the root logger has no handlers.
That creates a default root StreamHandler. Libraries such as tmt use propagating DEBUG-level loggers with their own filtering, so once the root handler exists, their records also get emitted with Python's default format which clutters CI output e.g. [1],
Log through the testcloud.util module logger instead, preserving the existing library-mode NullHandler behavior and avoiding implicit root logger configuration. Add a regression test for the missing selinuxenabled path.
[1] https://github.com/coiby/kernel-auto-bisect/actions/runs/27798088731/job/82262170969?pr=5