Skip to content

Avoid root logger setup when SELinux helper is missing - #30

Merged
happz merged 1 commit into
teemtee:mainfrom
coiby:has_selinux_log
Jul 2, 2026
Merged

Avoid root logger setup when SELinux helper is missing#30
happz merged 1 commit into
teemtee:mainfrom
coiby:has_selinux_log

Conversation

@coiby

@coiby coiby commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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
                #1: default-0

            provision.provision task #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

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
@coiby
coiby force-pushed the has_selinux_log branch from 2e1cc64 to eda374a Compare June 20, 2026 00:05
coiby added a commit to coiby/kernel-auto-bisect that referenced this pull request Jun 20, 2026
tmt is natively supported on Fedora. By using Fedora container, some
benefits includes bypassing issue [1].

[1] teemtee/testcloud#30
coiby added a commit to coiby/kernel-auto-bisect that referenced this pull request Jun 21, 2026
tmt is natively supported on Fedora. By using Fedora container, some
benefits includes bypassing issue [1].

[1] teemtee/testcloud#30
coiby added a commit to coiby/kernel-auto-bisect that referenced this pull request Jun 21, 2026
tmt is natively supported on Fedora. By using Fedora container, some
benefits includes bypassing issue [1].

[1] teemtee/testcloud#30
@happz happz added this to planning Jun 24, 2026
@github-project-automation github-project-automation Bot moved this to backlog in planning Jun 24, 2026
@happz happz moved this from backlog to review in planning Jun 24, 2026
@happz happz added the bug Something isn't working label Jun 24, 2026
@LecrisUT LecrisUT moved this from review to merge in planning Jul 2, 2026
@happz
happz merged commit 6edea25 into teemtee:main Jul 2, 2026
@github-project-automation github-project-automation Bot moved this from merge to done in planning Jul 2, 2026
coiby added a commit to coiby/kernel-auto-bisect that referenced this pull request Jul 3, 2026
tmt is natively supported on Fedora. By using Fedora container, some
benefits includes bypassing issue [1].

[1] teemtee/testcloud#30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

3 participants