From 303d6de5c76443facf99616caaedc153ecc3fc0c Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Fri, 6 Oct 2023 18:40:07 -0400 Subject: [PATCH] [docker] Fix runtime check_is_active sysroot consideration A runtime's `check_is_active()` does not get passed a sysroot at any point, so the docker runtime abstraction should just use the policy sysroot directly. Additionally, `check_can_copy()` should be simplified to simply return the already-determined active state of the runtime. Signed-off-by: Jake Hunsaker --- sos/policies/runtimes/docker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sos/policies/runtimes/docker.py b/sos/policies/runtimes/docker.py index c0cc156c38..ef2d8e5984 100644 --- a/sos/policies/runtimes/docker.py +++ b/sos/policies/runtimes/docker.py @@ -18,9 +18,9 @@ class DockerContainerRuntime(ContainerRuntime): name = 'docker' binary = 'docker' - def check_is_active(self, sysroot=None): + def check_is_active(self): # the daemon must be running - if (is_executable('docker', sysroot) and + if (is_executable('docker', self.policy.sysroot) and (self.policy.init_system.is_running('docker') or self.policy.init_system.is_running('snap.docker.dockerd'))): self.active = True @@ -28,6 +28,6 @@ def check_is_active(self, sysroot=None): return False def check_can_copy(self): - return self.check_is_active(sysroot=self.policy.sysroot) + return self.active # vim: set et ts=4 sw=4 :