All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Asleson <tasleson@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - lvmdbusd: Raise LvmBug exception for invalid JSON
Date: Mon, 19 Sep 2022 15:58:29 +0000 (GMT)	[thread overview]
Message-ID: <20220919155829.AB28E3858289@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f4c03faa6556489444cf9402b2a35c46e7282ed3
Commit:        f4c03faa6556489444cf9402b2a35c46e7282ed3
Parent:        85fcbfd9d7697d3954c4f13a791f127205e260ee
Author:        Tony Asleson <tasleson@redhat.com>
AuthorDate:    Wed Aug 31 15:08:09 2022 -0500
Committer:     Tony Asleson <tasleson@redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500

lvmdbusd: Raise LvmBug exception for invalid JSON

This will cause lvm debug data to get logged if it's available.
---
 daemons/lvmdbusd/cmdhandler.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 102844739..1a7943f01 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -621,9 +621,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:
-		# With the current implementation, if we are using the shell then we
-		# are using JSON and JSON is returned back to us as it was parsed to
-		# figure out if we completed OK or not
+		# If the 'call' implementation is lvmshell, the out is a dictionary as lvmshell has to
+		# parse the output to get the exit value.  When doing fork & exec, out is a string
+		# representing the JSON.  TODO: Make this consistent between implementations.
 		if cfg.SHELL_IN_USE:
 			assert(type(out) == dict)
 			return out
@@ -633,7 +633,7 @@ def lvm_full_report_json():
 			except json.decoder.JSONDecodeError as joe:
 				log_error("JSONDecodeError %s, \n JSON=\n%s\n" %
 							(str(joe), out))
-				raise joe
+				raise LvmBug("'fullreport' returned invalid JSON")
 
 	raise LvmBug("'fullreport' exited with code '%d'" % rc)
 


                 reply	other threads:[~2022-09-19 15:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220919155829.AB28E3858289@sourceware.org \
    --to=tasleson@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.