diff options
-rw-r--r-- | sos/collector/sosnode.py | 13 | ||||
-rw-r--r-- | sos/policies/__init__.py | 2 | ||||
-rw-r--r-- | sos/policies/debian.py | 1 | ||||
-rw-r--r-- | sos/policies/redhat.py | 2 |
4 files changed, 12 insertions, 6 deletions
diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py index 1f5718bf..a3338f4b 100644 --- a/sos/collector/sosnode.py +++ b/sos/collector/sosnode.py @@ -62,6 +62,7 @@ class SosNode(): 'presets': [], 'sos_cmd': commons['sos_cmd'] } + self.sos_bin = 'sosreport' filt = ['localhost', '127.0.0.1'] self.soslog = logging.getLogger('sos') self.ui_log = logging.getLogger('sos_ui') @@ -390,9 +391,6 @@ class SosNode(): self.log_debug("Error while trying to create new SSH control " "socket: %s" % err) raise - if cmd.startswith('sosreport'): - cmd = cmd.replace('sosreport', self.host.sos_bin_path) - need_root = True if use_container and self.host.containerized: cmd = self.host.format_container_command(cmd) if need_root: @@ -649,6 +647,15 @@ class SosNode(): if self.opts.since: sos_opts.append('--since=%s' % quote(self.opts.since)) + # sos-4.0 changes the binary + if self.check_sos_version('4.0'): + self.sos_bin = 'sos report' + + sos_cmd = sos_cmd.replace( + 'sosreport', + os.path.join(self.host.sos_bin_path, self.sos_bin) + ) + if self.opts.only_plugins: plugs = [o for o in self.opts.only_plugins if self._plugin_exists(o)] diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 112fbf62..5f7cb0bf 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -1289,7 +1289,7 @@ class LinuxPolicy(Policy): container_image = None sos_path_strip = None sos_pkg_name = None - sos_bin_path = None + sos_bin_path = '/usr/bin' sos_container_name = 'sos-collector-tmp' container_version_command = None diff --git a/sos/policies/debian.py b/sos/policies/debian.py index f1843d53..6e32fac8 100644 --- a/sos/policies/debian.py +++ b/sos/policies/debian.py @@ -17,7 +17,6 @@ class DebianPolicy(LinuxPolicy): PATH = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" \ + ":/usr/local/sbin:/usr/local/bin" sos_pkg_name = 'sosreport' - sos_bin_path = '/usr/bin/sosreport' def __init__(self, sysroot=None, init=None, probe_runtime=True, remote_exec=None): diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py index 0634ae10..0533e6dc 100644 --- a/sos/policies/redhat.py +++ b/sos/policies/redhat.py @@ -39,7 +39,7 @@ class RedHatPolicy(LinuxPolicy): upload_directory = '/incoming' default_container_runtime = 'podman' sos_pkg_name = 'sos' - sos_bin_path = '/usr/sbin/sosreport' + sos_bin_path = '/usr/sbin' def __init__(self, sysroot=None, init=None, probe_runtime=True, remote_exec=None): |