diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2019-03-19 17:30:16 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-03-19 17:30:16 +0000 |
commit | 430806a2bc1d11b60b867e0296e7200e17595cfc (patch) | |
tree | bed13d0bf3d320de12b0c8f96ddf2e3e745c60cc | |
parent | 39995744dcc81df56baf173fdbfc1b1a037f3ced (diff) | |
download | sos-430806a2bc1d11b60b867e0296e7200e17595cfc.tar.gz |
[sosreport] raise SystemExit out of list handlers
Since the temporary directories have already been set up by the
time we process the --list-* handling (plugins, profiles, presets),
we still need to follow the _cleanup() path at exit.
To avoid a duplicate _cleanup() and resulting File Not Found
exception, raise SystemExit out of these paths, which takes us
through the normal exception handling in SoSReport.execute() and
is consistent with all other paths through the command.
Resolves: #1594.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/sosreport.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py index 0d87ba95..d8c862db 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -1455,13 +1455,13 @@ class SoSReport(object): if self.opts.list_plugins: self.list_plugins() - return True + raise SystemExit if self.opts.list_profiles: self.list_profiles() - return True + raise SystemExit if self.opts.list_presets: self.list_presets() - return True + raise SystemExit if self.opts.add_preset: return self.add_preset(self.opts.add_preset) if self.opts.del_preset: @@ -1501,6 +1501,5 @@ def main(args): """The main entry point""" sos = SoSReport(args) sos.execute() - sos._cleanup() # vim: set et ts=4 sw=4 : |