diff options
-rw-r--r-- | sos/policies/__init__.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 4657614a..cea4c091 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -57,11 +57,14 @@ class PackageManager(object): query_command = None timeout = 30 + chroot = None - def __init__(self, query_command=None): + def __init__(self, query_command=None, chroot=None): self.packages = {} if query_command: self.query_command = query_command + if chroot: + self.chroot = chroot def all_pkgs_by_name(self, name): """ @@ -93,7 +96,11 @@ class PackageManager(object): version': 'major.minor.version'}} """ if self.query_command: - pkg_list = shell_out(self.query_command, self.timeout).splitlines() + cmd = self.query_command + pkg_list = shell_out( + cmd, timeout=self.timeout, chroot=self.chroot + ).splitlines() + for pkg in pkg_list: if '|' not in pkg: continue @@ -145,6 +152,9 @@ No changes will be made to system configuration. vendor_text = "" PATH = "" + _in_container = False + _host_sysroot = '/' + def __init__(self): """Subclasses that choose to override this initializer should call super() to ensure that they get the required platform bits attached. @@ -180,6 +190,14 @@ No changes will be made to system configuration. """ return False + def in_container(self): + """ Returns True if sos is running inside a container environment. + """ + return self._in_container + + def host_sysroot(self): + return self._host_sysroot + def dist_version(self): """ Return the OS version |