918 | @@ -919,6 +919,8 @@ def send_cli(self, clicommand=None, *args, **kwargs):
919 | # Ignore cli_stdout, raise with cli_stderr
920 | raise subprocess.CalledProcessError(returncode, p_args, output=cli_stderr)
921 | try:
922 | + if not cli_stdout.strip():
923 | + return None
924 | return json.loads(cli_stdout, parse_float=decimal.Decimal)
925 | except (json.JSONDecodeError, decimal.InvalidOperation):
926 | return cli_stdout.rstrip("\n")
nit: checking for cli_stdout shouldn't be outside the try? also cos it shouldn't fail and if it does the except is also accessing it...
raise subprocess.CalledProcessError(returncode, p_args, output=cli_stderr)
if not cli_stdout.strip():
return None
try:
return json.loads(cli_stdout, parse_float=decimal.Decimal)
except (json.JSONDecodeError, decimal.InvalidOperation):
return cli_stdout.rstrip("\n")
I think this was more to keep the logic in one place