From: Tomer Haskalovitch Date: Sun, 4 Jan 2026 09:01:32 +0000 (+0200) Subject: mgr/dashboard: add indentation to the json output of nvmeof cli commands X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F66783%2Fhead;p=ceph.git mgr/dashboard: add indentation to the json output of nvmeof cli commands Signed-off-by: Tomer Haskalovitch --- diff --git a/src/pybind/mgr/dashboard/services/nvmeof_cli.py b/src/pybind/mgr/dashboard/services/nvmeof_cli.py index 6cb8d361f5d..011eb58359d 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 a992553287b..0a673d8da15 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()