Bug 2216608
| Summary: | Exception raised by hpssm plugin in plug.setup(). | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Daniel Reynolds <dareynol> | |
| Component: | sos | Assignee: | Pavel Moravec <pmoravec> | |
| Status: | CLOSED ERRATA | QA Contact: | Miroslav HradĂlek <mhradile> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 8.6 | CC: | agk, jcastillo, jjansky, mhradile, pgm-rhel-tools, plambri, ppaddhar, sbradley, snavale, theute, toneata | |
| Target Milestone: | rc | Keywords: | OtherQA, Triaged, ZStream | |
| Target Release: | --- | Flags: | dareynol:
needinfo-
pm-rhel: mirror+ |
|
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | sos-4.5.5-2.el8 | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 2221103 (view as bug list) | Environment: | ||
| Last Closed: | 2023-07-26 08:37:56 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: | 2221103 | |||
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. Upstream PR can be found here: https://github.com/sosreport/sos/pull/3285 Will you be able to test this fix for us when we will have release candidate? *** Bug 2221103 has been marked as a duplicate of this bug. *** Hello Jan, Have shared the links to the new package with the customer and requested that they test it. Regards 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.