Try to parse output as json in case of an error exit code, and output the error key
This commit is contained in:
parent
a0377961c4
commit
706b95071c
1 changed files with 6 additions and 0 deletions
|
|
@ -150,6 +150,12 @@ def run_iperf3(options) -> Union[dict, NoReturn]:
|
|||
if e.errno == 2:
|
||||
nagexit(3, "cannot find iperf3")
|
||||
except subprocess.CalledProcessError as e:
|
||||
try:
|
||||
json_data = json.loads(e.output)
|
||||
if "error" in json_data:
|
||||
nagexit(3, json_data["error"])
|
||||
except Exception as ex:
|
||||
pass
|
||||
nagexit(3, e.output)
|
||||
nagexit(3, "what happended?")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue