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.
DescriptionDaniel Reynolds
2023-06-22 04:49:38 UTC
Description of problem:
Version-Release number of selected component (if applicable):
- sos-4.5.0-1.el8
How reproducible:
- Only on customers specific hardware. Then, always.
Steps to Reproduce:
1. `sudo sosreport --batch`
Actual results:
Exception running 'hpssm' plugin.
~~~
Please note the 'sosreport' command has been deprecated in favor of the new 'sos' command, E.G. 'sos report'.
Redirecting to 'sos report --batch'
sosreport (version 4.5.0)
[snip]
caught exception in plugin method "hpssm.setup()"
writing traceback to sos_logs/hpssm-plugin-errors.txt
Retrieving Linux Extensions Configuration ...
[snip]
Your sosreport has been generated and saved in:
/var/tmp/sosreport-dl360x4140-2023-06-07-pmtslmo.tar.xz
Size 23.51MiB
Owner root
sha256 f8bc2de2ac33af75f518b06ddfa2bf08819d7f1b843d969033d4184d7fcb247e
~~~
Expected results:
No exception running hpssm plugin.
Additional info:
- From 'sos_logs/hpssm-plugin-errors.txt'
~~~
$ cat sos_logs/hpssm-plugin-errors.txt
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/sos/report/__init__.py", line 1217, in setup
plug.setup()
File "/usr/lib/python3.6/site-packages/sos/report/plugins/hpssm.py", line 67, in setup
logpath = self.get_cmd_output_path()
File "/usr/lib/python3.6/site-packages/sos/report/plugins/__init__.py", line 2167, in get_cmd_output_path
os.makedirs(cmd_output_path)
File "/usr/lib64/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/var/tmp/sos.8d8v8__a/sosreport-seliics03349-2023-06-08-enmwtcf/sos_commands/hpssm'
~~~
- If hpssm plugin is disabled, no exception is raised.
- Clearing /var/tmp of sos directories does not resolve the issue.
The problem here seems to be that we call the function get_cmd_output_path() with the default values, here:
logpath = self.get_cmd_output_path()
And by default it tries to create the directory, which in our case has been already created, if I'm reading it correctly:
def get_cmd_output_path(self, name=None, make=True): <-- default is to create dir
"""Get the path where this plugin will save command output
:param name: Optionally specify a filename to use as part of the
command output path
:type name: ``str`` or ``None``
:param make: Attempt to create the command output path
:type make: ``bool``
:returns: The path where the plugin will write command output data
within the archive
:rtype: ``str``
"""
cmd_output_path = os.path.join(self.archive.get_tmp_dir(),
'sos_commands', self.name())
if name:
cmd_output_path = os.path.join(cmd_output_path, name)
if make:
os.makedirs(cmd_output_path) <-- So we end up here attempting to create an already existing dir
I have a couple of ideas about how to solve this, but will need to test them first.
(In reply to Jose Castillo from comment #1)
> The problem here seems to be that we call the function get_cmd_output_path()
> with the default values, here:
>
> logpath = self.get_cmd_output_path()
>
>
> And by default it tries to create the directory, which in our case has been
> already created, if I'm reading it correctly:
>
> def get_cmd_output_path(self, name=None, make=True):
> <-- default is to create dir
> """Get the path where this plugin will save command output
>
> :param name: Optionally specify a filename to use as part of the
> command output path
> :type name: ``str`` or ``None``
>
> :param make: Attempt to create the command output path
> :type make: ``bool``
>
> :returns: The path where the plugin will write command output data
> within the archive
> :rtype: ``str``
> """
> cmd_output_path = os.path.join(self.archive.get_tmp_dir(),
> 'sos_commands', self.name())
> if name:
> cmd_output_path = os.path.join(cmd_output_path, name)
> if make:
> os.makedirs(cmd_output_path) <-- So we end up here
> attempting to create an already existing dir
>
> I have a couple of ideas about how to solve this, but will need to test them
> first.
Three *possible* ideas (dont saying the best ones):
1) enhance get_cmd_output_path by optional parameter skip_if_present and call os.makedirs with exist_ok=skip_if_present option (to have plugins the ability to configure it (is there a need for it..?))
2) call the os.makedirs always with exist_ok=True (pragmatically saying, we just want to make it created, right?)
3) put the os.makedirs call into try-catch block and raise a warning in catch branch (likewise 2) but with an extra warn log)
I'm testing exist_ok=True, because that will catch if the dir has been created up to the point when we call os.makedirs(), because I think this may help better to avoid race conditions.
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/RHBA-2023:4279
Description of problem: Version-Release number of selected component (if applicable): - sos-4.5.0-1.el8 How reproducible: - Only on customers specific hardware. Then, always. Steps to Reproduce: 1. `sudo sosreport --batch` Actual results: Exception running 'hpssm' plugin. ~~~ Please note the 'sosreport' command has been deprecated in favor of the new 'sos' command, E.G. 'sos report'. Redirecting to 'sos report --batch' sosreport (version 4.5.0) [snip] caught exception in plugin method "hpssm.setup()" writing traceback to sos_logs/hpssm-plugin-errors.txt Retrieving Linux Extensions Configuration ... [snip] Your sosreport has been generated and saved in: /var/tmp/sosreport-dl360x4140-2023-06-07-pmtslmo.tar.xz Size 23.51MiB Owner root sha256 f8bc2de2ac33af75f518b06ddfa2bf08819d7f1b843d969033d4184d7fcb247e ~~~ Expected results: No exception running hpssm plugin. Additional info: - From 'sos_logs/hpssm-plugin-errors.txt' ~~~ $ cat sos_logs/hpssm-plugin-errors.txt Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/sos/report/__init__.py", line 1217, in setup plug.setup() File "/usr/lib/python3.6/site-packages/sos/report/plugins/hpssm.py", line 67, in setup logpath = self.get_cmd_output_path() File "/usr/lib/python3.6/site-packages/sos/report/plugins/__init__.py", line 2167, in get_cmd_output_path os.makedirs(cmd_output_path) File "/usr/lib64/python3.6/os.py", line 220, in makedirs mkdir(name, mode) FileExistsError: [Errno 17] File exists: '/var/tmp/sos.8d8v8__a/sosreport-seliics03349-2023-06-08-enmwtcf/sos_commands/hpssm' ~~~ - If hpssm plugin is disabled, no exception is raised. - Clearing /var/tmp of sos directories does not resolve the issue.