diff --git a/sos-bz2041855-virsh-in-foreground.patch b/sos-bz2041855-virsh-in-foreground.patch index 8eca3fb..66bca13 100644 --- a/sos-bz2041855-virsh-in-foreground.patch +++ b/sos-bz2041855-virsh-in-foreground.patch @@ -1,3 +1,59 @@ +From 137abd394f64a63b6633949b5c81159af12038b7 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Fri, 14 Jan 2022 20:07:17 +0100 +Subject: [PATCH] [report] pass foreground argument to collect_cmd_output + +Related to: #2825 + +Signed-off-by: Pavel Moravec +--- + sos/report/plugins/__init__.py | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py +index 98f163ab9..1bbdf28a4 100644 +--- a/sos/report/plugins/__init__.py ++++ b/sos/report/plugins/__init__.py +@@ -1920,6 +1920,8 @@ class Plugin(object): + :param subdir: Subdir in plugin directory to save to + :param changes: Does this cmd potentially make a change + on the system? ++ :param foreground: Run the `cmd` in the foreground with a ++ TTY + :param tags: Add tags in the archive manifest + :param cmd_as_tag: Format command string to tag + +@@ -2145,7 +2147,8 @@ def collect_cmd_output(self, cmd, suggest_filename=None, + root_symlink=False, timeout=None, + stderr=True, chroot=True, runat=None, env=None, + binary=False, sizelimit=None, pred=None, +- changes=False, subdir=None, tags=[]): ++ changes=False, foreground=False, subdir=None, ++ tags=[]): + """Execute a command and save the output to a file for inclusion in the + report, then return the results for further use by the plugin + +@@ -2188,6 +2191,9 @@ def collect_cmd_output(self, cmd, suggest_filename=None, + on the system? + :type changes: ``bool`` + ++ :param foreground: Run the `cmd` in the foreground with a TTY ++ :type foreground: ``bool`` ++ + :param tags: Add tags in the archive manifest + :type tags: ``str`` or a ``list`` of strings + +@@ -2206,8 +2212,8 @@ def collect_cmd_output(self, cmd, suggest_filename=None, + return self._collect_cmd_output( + cmd, suggest_filename=suggest_filename, root_symlink=root_symlink, + timeout=timeout, stderr=stderr, chroot=chroot, runat=runat, +- env=env, binary=binary, sizelimit=sizelimit, subdir=subdir, +- tags=tags ++ env=env, binary=binary, sizelimit=sizelimit, foreground=foreground, ++ subdir=subdir, tags=tags + ) + + def exec_cmd(self, cmd, timeout=None, stderr=True, chroot=True, From 747fef695e4ff08f320c5f03090bdefa7154c761 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Fri, 14 Jan 2022 20:10:22 +0100 @@ -56,3 +112,35 @@ index d6b7c16761..08f9a8488c 100644 + foreground=True) + # vim: et ts=4 sw=4 +From 9bc032129ec66766f07349dd115335f104888efa Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Wed, 26 Jan 2022 09:44:01 +0100 +Subject: [PATCH] [virsh] Catch parsing exception + +In case virsh output is malformed or missing 'Name' otherwise, +catch parsing exception and continue in next for loop iteration. + +Resolves: #2836 + +Signed-off-by: Pavel Moravec +--- + sos/report/plugins/virsh.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sos/report/plugins/virsh.py b/sos/report/plugins/virsh.py +index 08f9a8488..2ce1df15c 100644 +--- a/sos/report/plugins/virsh.py ++++ b/sos/report/plugins/virsh.py +@@ -48,7 +48,11 @@ def setup(self): + if k_list['status'] == 0: + k_lines = k_list['output'].splitlines() + # the 'Name' column position changes between virsh cmds +- pos = k_lines[0].split().index('Name') ++ # catch the rare exceptions when 'Name' is not found ++ try: ++ pos = k_lines[0].split().index('Name') ++ except Exception: ++ continue + for j in filter(lambda x: x, k_lines[2:]): + n = j.split()[pos] + self.add_cmd_output('%s %s-dumpxml %s' % (cmd, k, n), diff --git a/sos.spec b/sos.spec index 3b90d30..5da5db9 100644 --- a/sos.spec +++ b/sos.spec @@ -5,7 +5,7 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos Version: 4.2 -Release: 12%{?dist} +Release: 13%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz Source1: sos-audit-%{auditversion}.tgz @@ -143,6 +143,10 @@ of the system. Currently storage and filesystem commands are audited. %changelog +* Wed Jan 26 2022 Pavel Moravec = 4.2-13 +- [virsh] Catch parsing exception + Resolves: bz2041855 + * Tue Jan 25 2022 Pavel Moravec = 4.2-12 - [foreman] Use psql-msgpack-decode wrapper for dynflow >= 1.6 Resolves: bz2043104