diff options
author | Tony Asleson <tasleson@redhat.com> | 2021-06-14 22:04:09 -0500 |
---|---|---|
committer | Tony Asleson <tasleson@redhat.com> | 2021-06-17 09:14:29 -0500 |
commit | f7730406254f023216d0727c82d46de82c124c92 (patch) | |
tree | d423b478ffc12991bd386d7b28faaea8cdb255d2 | |
parent | c474f174cc8b0e855f984bf211f5416b42c644a1 (diff) | |
download | lvm2-f7730406254f023216d0727c82d46de82c124c92.tar.gz |
lvmdbusd: Wrap json.load in try/except
In testing where we inject large amounts of additional output in stderr
we can occassionally get truncated stdout from lvm. Catching and dumping
the json for debug before we re-raise the exception. As this doesn't
happen without the error injecting wrapper around lvm, the error seems to
be with the wrapper.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
-rw-r--r-- | daemons/lvmdbusd/cmdhandler.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py index 91f69abcf..b88bd9896 100644 --- a/daemons/lvmdbusd/cmdhandler.py +++ b/daemons/lvmdbusd/cmdhandler.py @@ -627,7 +627,13 @@ def lvm_full_report_json(): assert(type(out) == dict) return out else: - return json.loads(out) + try: + return json.loads(out) + except json.decoder.JSONDecodeError as joe: + log_error("JSONDecodeError %s, \n JSON=\n%s\n" % + (str(joe), out)) + raise joe + return None |