diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2022-02-08 09:32:38 +0100 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-02-08 11:03:26 -0500 |
commit | ead8d48d12c84b88dee981efceb9c80dce7af418 (patch) | |
tree | 5103e490425b2807d40369ae9a023b42143fcb7b | |
parent | a96860356e0d0ee6d8e0608edfb8d0beb49c0579 (diff) | |
download | sos-ead8d48d12c84b88dee981efceb9c80dce7af418.tar.gz |
[dellrac] ensure the logpath directory exists
Due to the runat=logpath argument, we must ensure the logpath directory
is created. Also catch properly the case when the directory has been
created before.
Resolves: #2845
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/report/plugins/dellrac.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sos/report/plugins/dellrac.py b/sos/report/plugins/dellrac.py index ebae4151..cf6bd219 100644 --- a/sos/report/plugins/dellrac.py +++ b/sos/report/plugins/dellrac.py @@ -34,7 +34,13 @@ class DellRAC(Plugin, IndependentPlugin): self.do_debug() def do_debug(self): - logpath = self.get_cmd_output_path(make=False) + # ensure the sos_commands/dellrac directory does exist in either case + # as we will need to run the command at that dir, and also ensure + # logpath is properly populated in either case as well + try: + logpath = self.get_cmd_output_path() + except FileExistsError: + logpath = self.get_cmd_output_path(make=False) subcmd = 'supportassist collect -f' self.add_cmd_output( '%s %s support.zip' % (self.racadm, subcmd), |