Skip to content

Commit

Permalink
[collect] Fix exception while parsing sos help
Browse files Browse the repository at this point in the history
While parsing the output of 'sos report -l', we
were attempting to split an empty line, and
getting the following exception:

[<ip address>:_regex_sos_help] Error parsing sos help: list index out of range

Related: #3827

Signed-off-by: Jose Castillo <[email protected]>
  • Loading branch information
jcastill authored and TurboTurtle committed Nov 7, 2024
1 parent a8152cf commit 44fae16
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sos/collector/sosnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ def _regex_sos_help(self, regex, sosinfo, is_list=False):
for line in result.splitlines():
if not is_list:
try:
res.append(line.split()[0])
if ls := line.split():
res.append(ls[0])
except Exception as err:
self.log_debug(f"Error parsing sos help: {err}")
else:
Expand Down

0 comments on commit 44fae16

Please sign in to comment.