From 3d854b39bd8c3740eae087c4d46e5f685b368f5e Mon Sep 17 00:00:00 2001 From: Tony Asleson Date: Thu, 9 Mar 2023 11:19:29 -0600 Subject: lvmdbusd: Replace assert with exception Instead of using an assert we will raise an LvmBug exception --- daemons/lvmdbusd/cmdhandler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'daemons') diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py index 8bc741dc6..cf2a70875 100644 --- a/daemons/lvmdbusd/cmdhandler.py +++ b/daemons/lvmdbusd/cmdhandler.py @@ -637,7 +637,9 @@ def lvm_full_report_json(): rc, out, err = call(cmd) # When we have an exported vg the exit code of lvs or fullreport will be 5 if rc == 0 or rc == 5: - assert(type(out) == dict) + if type(out) != dict: + raise LvmBug("lvm likely returned invalid JSON, lvm exit code = %d, output = %s, err= %s" % + (rc, str(out), str(err))) return out raise LvmBug("'fullreport' exited with code '%d'" % rc) -- cgit v1.2.1