mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
lvmdbusd: Raise LvmBug exception for invalid JSON
This will cause lvm debug data to get logged if it's available.
This commit is contained in:
parent
85fcbfd9d7
commit
f4c03faa65
@ -621,9 +621,9 @@ def lvm_full_report_json():
|
|||||||
rc, out, err = call(cmd)
|
rc, out, err = call(cmd)
|
||||||
# When we have an exported vg the exit code of lvs or fullreport will be 5
|
# When we have an exported vg the exit code of lvs or fullreport will be 5
|
||||||
if rc == 0 or rc == 5:
|
if rc == 0 or rc == 5:
|
||||||
# With the current implementation, if we are using the shell then we
|
# If the 'call' implementation is lvmshell, the out is a dictionary as lvmshell has to
|
||||||
# are using JSON and JSON is returned back to us as it was parsed to
|
# parse the output to get the exit value. When doing fork & exec, out is a string
|
||||||
# figure out if we completed OK or not
|
# representing the JSON. TODO: Make this consistent between implementations.
|
||||||
if cfg.SHELL_IN_USE:
|
if cfg.SHELL_IN_USE:
|
||||||
assert(type(out) == dict)
|
assert(type(out) == dict)
|
||||||
return out
|
return out
|
||||||
@ -633,7 +633,7 @@ def lvm_full_report_json():
|
|||||||
except json.decoder.JSONDecodeError as joe:
|
except json.decoder.JSONDecodeError as joe:
|
||||||
log_error("JSONDecodeError %s, \n JSON=\n%s\n" %
|
log_error("JSONDecodeError %s, \n JSON=\n%s\n" %
|
||||||
(str(joe), out))
|
(str(joe), out))
|
||||||
raise joe
|
raise LvmBug("'fullreport' returned invalid JSON")
|
||||||
|
|
||||||
raise LvmBug("'fullreport' exited with code '%d'" % rc)
|
raise LvmBug("'fullreport' exited with code '%d'" % rc)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user