diff --git a/qa/1480 b/qa/1480 index f399cba0ae..624c99696f 100755 --- a/qa/1480 +++ b/qa/1480 @@ -93,7 +93,7 @@ END { print int(sum+0.5) }'` echo "pminfo -f lmsensors output:" >> $seq_full PMDA=`pminfo -f lmsensors | tee -a $seq_full | grep '^ *value ' | \ - awk '{ sum += $2 } END { print sum }'` + awk '{ sum += $2 } END { print sum+0 }'` if _within_tolerance "Expecting $SENS +- 10%" $PMDA $SENS 10%; then echo -n "The output of the 'sensors -u' values differs not more than 10% " diff --git a/src/pmdas/lmsensors/pmdalmsensors.python b/src/pmdas/lmsensors/pmdalmsensors.python index c6eb141e18..bbcbe15471 100755 --- a/src/pmdas/lmsensors/pmdalmsensors.python +++ b/src/pmdas/lmsensors/pmdalmsensors.python @@ -53,7 +53,13 @@ def lmsensors_get(chip=None): if chip: cmd.append(chip) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=devnull) - output = json.loads(re.sub("[0-9]_", "_", p.communicate()[0].decode("utf-8"))) + raw = p.communicate()[0].decode("utf-8") + try: + output = json.loads(re.sub("[0-9]_", "_", raw)) + except (json.JSONDecodeError, ValueError): + if chip: + return + raise if args.debug_value and args.debug_value >= 0: print("function lmsensors_get(), json object after removing redundant naming:\n", output)