Blob Blame History Raw
From d9dd8ad790b6799491e4891ae19bb85124ab6794 Mon Sep 17 00:00:00 2001
From: Robert Thomas Manes <robb.manes@gmail.com>
Date: Fri, 17 Apr 2020 10:29:47 -0400
Subject: [PATCH] [redhat] fix RH containers without sysroot Attempting to run
 sosreport in a container currently will always traceback unless
 ENV_HOST_SYSROOT is set to '/'.

Allow default NoneType sysroot to function as well.

Resolves: #2028

Signed off by: Robb Manes <rmanes@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
 sos/policies/redhat.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index ba9bacf4..16cb23ec 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -144,7 +144,7 @@ class RedHatPolicy(LinuxPolicy):
                 self._in_container = True
         if ENV_HOST_SYSROOT in os.environ:
             self._host_sysroot = os.environ[ENV_HOST_SYSROOT]
-        use_sysroot = self._in_container and self._host_sysroot != '/'
+        use_sysroot = self._in_container and self._host_sysroot is not None
         if use_sysroot:
             host_tmp_dir = os.path.abspath(self._host_sysroot + self._tmp_dir)
             self._tmp_dir = host_tmp_dir
-- 
2.21.3