Message ID | 20230613180828.1235964-2-ashelat@redhat.com |
---|---|
State | New |
Headers | show |
Series | rteval: osinfo.py: Added code to use 'sos report' instead of sosreport. | expand |
On Tue, 13 Jun 2023, Anubhav Shelat wrote: > sosreport is deprecated, so if available on the system osinfo will try > to use the sos command instead. > > Signed-off-by: Anubhav Shelat <ashelat@redhat.com> > --- > rteval/sysinfo/osinfo.py | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py > index 83dc78b96fdd..0c570c0e395b 100644 > --- a/rteval/sysinfo/osinfo.py > +++ b/rteval/sysinfo/osinfo.py > @@ -62,12 +62,14 @@ class OSInfo: > > > def run_sysreport(self, repdir): > - if os.path.exists('/usr/sbin/sosreport'): > + if os.path.exists('/usr/sbin/sos'): > + exe = '/usr/sbin/sos report' > + elif os.path.exists('/usr/sbin/sosreport'): > exe = '/usr/sbin/sosreport' > elif os.path.exists('/usr/sbin/sysreport'): > exe = '/usr/sbin/sysreport' > else: > - raise RuntimeError("Can't find sosreport/sysreport") > + raise RuntimeError("Can't find sos/sosreport/sysreport") > > self.__logger.log(Log.DEBUG, f"report tool: {exe}") > options = ['-k', 'rpm.rpmva=off', > @@ -75,8 +77,8 @@ class OSInfo: > '--batch'] > > self.__logger.log(Log.INFO, "Generating SOS report") > - self.__logger.log(Log.INFO, f"using command {' '.join([exe]+options)}") > - subprocess.call([exe] + options) > + self.__logger.log(Log.INFO, f"using command {' '.join(exe.split()+options)}") > + subprocess.call(exe.split() + options) > for s in glob('/tmp/s?sreport-rteval-*'): > self.__logger.log(Log.DEBUG, f"moving {s} to {repdir}") > shutil.move(s, repdir) > -- > 2.31.1 > > Signed-off-by: John Kacur <jkacur@redhat.com>
diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py index 83dc78b96fdd..0c570c0e395b 100644 --- a/rteval/sysinfo/osinfo.py +++ b/rteval/sysinfo/osinfo.py @@ -62,12 +62,14 @@ class OSInfo: def run_sysreport(self, repdir): - if os.path.exists('/usr/sbin/sosreport'): + if os.path.exists('/usr/sbin/sos'): + exe = '/usr/sbin/sos report' + elif os.path.exists('/usr/sbin/sosreport'): exe = '/usr/sbin/sosreport' elif os.path.exists('/usr/sbin/sysreport'): exe = '/usr/sbin/sysreport' else: - raise RuntimeError("Can't find sosreport/sysreport") + raise RuntimeError("Can't find sos/sosreport/sysreport") self.__logger.log(Log.DEBUG, f"report tool: {exe}") options = ['-k', 'rpm.rpmva=off', @@ -75,8 +77,8 @@ class OSInfo: '--batch'] self.__logger.log(Log.INFO, "Generating SOS report") - self.__logger.log(Log.INFO, f"using command {' '.join([exe]+options)}") - subprocess.call([exe] + options) + self.__logger.log(Log.INFO, f"using command {' '.join(exe.split()+options)}") + subprocess.call(exe.split() + options) for s in glob('/tmp/s?sreport-rteval-*'): self.__logger.log(Log.DEBUG, f"moving {s} to {repdir}") shutil.move(s, repdir)
sosreport is deprecated, so if available on the system osinfo will try to use the sos command instead. Signed-off-by: Anubhav Shelat <ashelat@redhat.com> --- rteval/sysinfo/osinfo.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)