Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2012856

Summary: sos report --dry-run raises uncaught exception
Product: Red Hat Enterprise Linux 8 Reporter: Pavel Moravec <pmoravec>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Miroslav HradĂ­lek <mhradile>
Severity: medium Docs Contact:
Priority: high    
Version: 8.6CC: agk, bmr, fkrska, mhradile, plambri, rduda, sbradley, theute
Target Milestone: rcKeywords: OtherQA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sos-4.2-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2012858 (view as bug list) Environment:
Last Closed: 2022-05-10 15:16:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2012858    

Description Pavel Moravec 2021-10-11 13:21:00 UTC
Description of problem:
TL;DR: backport https://github.com/sosreport/sos/pull/2711 .


Version-Release number of selected component (if applicable):
sos-4.2-1


How reproducible:
100%


Steps to Reproduce:
sos report --dry-run --batch --build -o logs


Actual results:
caught exception in plugin method "logs.setup()"
writing traceback to sos_logs/logs-plugin-errors.txt

Traceback:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/sos/report/__init__.py", line 977, in setup
    plug.setup()
  File "/usr/lib/python3.6/site-packages/sos/report/plugins/logs.py", line 66, in setup
    self.add_journal(since=since, tags='journal_full', priority=100)
  File "/usr/lib/python3.6/site-packages/sos/report/plugins/__init__.py", line 2512, in add_journal
    priority=priority)
  File "/usr/lib/python3.6/site-packages/sos/report/plugins/__init__.py", line 1660, in _add_cmd_output
    self.log_skipped_cmd(pred, soscmd.cmd, kmods=bool(pred.kmods),
AttributeError: 'NoneType' object has no attribute 'kmods'


Expected results:
No uncaught exception


Additional info:
(also covscan report reveals this, to put some weight to have it in 8.6/9.0)

Comment 1 Pavel Moravec 2021-11-04 08:17:44 UTC
(I manually checked this is fixed (not sure how valid is a test from a person in conflict of interests like me (author  & self-tester) :) ):

# rpm -q sos
sos-4.2-1.el8.noarch
# sos report --dry-run --batch --build -o logs

sosreport (version 4.2)
..
 Setting up archive ...
 Setting up plugins ...
[plugin:logs] skipped command 'journalctl --disk-usage': (dry run)
[plugin:logs] skipped command 'ls -alRh /var/log/': (dry run)
caught exception in plugin method "logs.setup()"
writing traceback to sos_logs/logs-plugin-errors.txt
 Running plugins. Please wait ...

  Starting 1/1   logs            [Running: logs]

  Finished running plugins


Your sosreport build tree has been generated in:
	/var/tmp/sosreport-pmoravec-rhel8-2021-11-04-igaqshi


# cat /var/tmp/sosreport-pmoravec-rhel8-2021-11-04-igaqshi/sos_logs/logs-plugin-errors.txt
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/sos/report/__init__.py", line 977, in setup
    plug.setup()
  File "/usr/lib/python3.6/site-packages/sos/report/plugins/logs.py", line 66, in setup
    self.add_journal(since=since, tags='journal_full', priority=100)
  File "/usr/lib/python3.6/site-packages/sos/report/plugins/__init__.py", line 2512, in add_journal
    priority=priority)
  File "/usr/lib/python3.6/site-packages/sos/report/plugins/__init__.py", line 1660, in _add_cmd_output
    self.log_skipped_cmd(pred, soscmd.cmd, kmods=bool(pred.kmods),
AttributeError: 'NoneType' object has no attribute 'kmods'

#

And on fixed version:

# rpm -q sos
sos-4.2-2.el8.noarch
# sos report --dry-run --batch --build -o logs


sosreport (version 4.2)

..

 Setting up archive ...
 Setting up plugins ...
[plugin:logs] skipped command 'journalctl --disk-usage': (dry run)
[plugin:logs] skipped command 'ls -alRh /var/log/': (dry run)
[plugin:logs] skipped command 'journalctl --no-pager ': (dry run)
[plugin:logs] skipped command 'journalctl --no-pager  --catalog --boot ': (dry run)
[plugin:logs] skipped command 'journalctl --no-pager  --catalog --boot -1': (dry run)
 Running plugins. Please wait ...

  Starting 1/1   logs            [Running: logs]

  Finished running plugins


Your sosreport build tree has been generated in:
	/var/tmp/sosreport-pmoravec-rhel8-2021-11-04-lwdjjug


# ls /var/tmp/sosreport-pmoravec-rhel8-2021-11-04-lwdjjug/sos_logs/
sos.log  ui.log
#

Comment 7 errata-xmlrpc 2022-05-10 15:16:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sos bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2022:1998