From 6bffd4771b6875e4599810feaa2135417d5a5638 Mon Sep 17 00:00:00 2001 From: Tomer Haskalovitch Date: Sun, 4 Jan 2026 11:01:32 +0200 Subject: [PATCH] mgr/dashboard: add indentation to the json output of nvmeof cli commands Signed-off-by: Tomer Haskalovitch --- src/pybind/mgr/dashboard/services/nvmeof_cli.py | 2 +- src/pybind/mgr/dashboard/tests/test_nvmeof_cli.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/nvmeof_cli.py b/src/pybind/mgr/dashboard/services/nvmeof_cli.py index 6cb8d361f5d4c..011eb58359db2 100644 --- a/src/pybind/mgr/dashboard/services/nvmeof_cli.py +++ b/src/pybind/mgr/dashboard/services/nvmeof_cli.py @@ -281,7 +281,7 @@ class NvmeofCLICommand(CLICommand): if out_format == 'plain' or not out_format: out = self._output_formatter.format_output(ret, self._model) elif out_format == 'json': - out = json.dumps(ret) + out = json.dumps(ret, indent=4) elif out_format == 'yaml': out = yaml.dump(ret) else: diff --git a/src/pybind/mgr/dashboard/tests/test_nvmeof_cli.py b/src/pybind/mgr/dashboard/tests/test_nvmeof_cli.py index a992553287be6..0a673d8da15be 100644 --- a/src/pybind/mgr/dashboard/tests/test_nvmeof_cli.py +++ b/src/pybind/mgr/dashboard/tests/test_nvmeof_cli.py @@ -85,7 +85,7 @@ class TestNvmeofCLICommand: result = NvmeofCLICommand.COMMANDS[sample_command].call(MagicMock(), {'format': 'json'}) assert isinstance(result, HandleCommandResult) assert result.retval == 0 - assert result.stdout == '{"a": "b"}' + assert json.loads(result.stdout) == {"a": "b"} assert result.stderr == '' base_call_mock.assert_called_once() -- 2.47.3