diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2020-05-22 11:37:26 +0100 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-05-26 09:49:00 -0400 |
commit | 2d17a97a5c2fdb34898cf83911cdad808fa313df (patch) | |
tree | 2d0c4cd2ed9c37f81cb1fe6a001f30ce9af16593 | |
parent | 569f261801d3a4da2852c0b40be78b701056edaa (diff) | |
download | sos-2d17a97a5c2fdb34898cf83911cdad808fa313df.tar.gz |
[sos] raise exceptions in SoS._init_component() when --debug
An exception in SoS._init_component() currently leads to a fairly
terse error even with --debug:
# sos report -vv --batch --debug
Could not initialize 'report': dictionary update sequence element #0 has length 1; 2 is required
By propagating the exception when --debug is given we get the full
backtrace on the terminal:
# sos report -vv --batch --debug
Could not initialize 'report': dictionary update sequence element #0 has length 1; 2 is required
Traceback (most recent call last):
File "/home/breeves/src/git/sos/bin/sos", line 21, in <module>
sos = SoS(sys.argv[1:])
File "/home/breeves/src/git/sos/sos/__init__.py", line 112, in __init__
self._init_component()
File "/home/breeves/src/git/sos/sos/__init__.py", line 153, in _init_component
raise err
File "/home/breeves/src/git/sos/sos/__init__.py", line 149, in _init_component
self.cmdline)
File "/home/breeves/src/git/sos/sos/report/__init__.py", line 118, in __init__
super(SoSReport, self).__init__(parser, args, cmdline)
File "/home/breeves/src/git/sos/sos/component.py", line 98, in __init__
self.policy = sos.policies.load(sysroot=self.opts.sysroot)
File "/home/breeves/src/git/sos/sos/policies/__init__.py", line 60, in load
if policy.check(remote=remote_check):
File "/home/breeves/src/git/sos/sos/policies/cos.py", line 30, in check
os_release = dict(line.strip().split('=') for line in fp
ValueError: dictionary update sequence element #0 has length 1; 2 is required
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/__init__.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sos/__init__.py b/sos/__init__.py index 3436dd9c..6c249d86 100644 --- a/sos/__init__.py +++ b/sos/__init__.py @@ -149,6 +149,8 @@ class SoS(): self.cmdline) except Exception as err: print("Could not initialize '%s': %s" % (_com, err)) + if self.args.debug: + raise err sys.exit(1) def execute(self): |