mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 04:53:01 +02:00
statd: also silence JSONDecodeError on check=False
In d616623a an attempt to silence bogus return values from mctl, when
multicast snooping is disabled on a bridge. That helped get data back
for operational to produce `show interfaces` *with* a bridge and ports
but still emitted bogus log warnings.
This patch addresses that by checking 'check' on JSONDcodeError as well
before emitting any log error.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -137,8 +137,9 @@ def run_json_cmd(cmd, testfile, default=None, check=True):
|
||||
return default
|
||||
raise
|
||||
except json.JSONDecodeError as err:
|
||||
logger.error(f"failed parsing JSON output of command: {' '.join(cmd)}"
|
||||
f", error: {err}")
|
||||
if check is True:
|
||||
logger.error("failed parsing JSON output of command: "
|
||||
f"{' '.join(cmd)}, error: {err}")
|
||||
if default is not None:
|
||||
return default
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user