diff --git a/tmt/steps/provision/podman.py b/tmt/steps/provision/podman.py index cd4a92c69f..36f6533be2 100644 --- a/tmt/steps/provision/podman.py +++ b/tmt/steps/provision/podman.py @@ -366,10 +366,13 @@ def push( if not self.is_ready: return - self.debug("Update selinux context of the run workdir.", level=3) + assert self.parent.plan.my_run is not None # narrow type assert self.parent.plan.workdir is not None # narrow type + # Relabel workdir to container_file_t if SELinux supported - if tmt.utils.is_selinux_supported(): + self.debug("Update selinux context of the run workdir.", level=3) + + if self.parent.plan.my_run.runner.facts.has_selinux: self._run_guest_command(Command( "chcon", "--recursive", "--type=container_file_t", self.parent.plan.workdir ), shell=False, silent=True) diff --git a/tmt/utils/__init__.py b/tmt/utils/__init__.py index 534da13281..e16dad2f60 100644 --- a/tmt/utils/__init__.py +++ b/tmt/utils/__init__.py @@ -5832,17 +5832,6 @@ def field( ) -@functools.cache -def is_selinux_supported() -> bool: - """ - Returns ``true`` if SELinux filesystem is supported by the kernel, ``false`` otherwise. - - For detection ``/proc/filesystems`` is used, see ``man 5 filesystems`` for details. - """ - with open('/proc/filesystems') as file: - return any('selinuxfs' in line for line in file) - - def locate_key_origin(node: fmf.Tree, key: str) -> Optional[fmf.Tree]: """ Find an fmf node where the given key is defined.