From: Afreen Misbah Date: Mon, 7 Apr 2025 19:00:08 +0000 (+0530) Subject: mgr/dashboard: Fix empty ceph version in GET api/hosts X-Git-Tag: v20.3.0~146^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1aa74cf3fce6394ad08e83e91a90923d983b03c5;p=ceph.git mgr/dashboard: Fix empty ceph version in GET api/hosts Fixes https://tracker.ceph.com/issues/70821 Due to the pagination the host list is being fetched from orchestrator which caused a regression as via orchestrator list ceph version is always marked empty. Caused by https://github.com/ceph/ceph/pull/52154 Also fixed tests , as the new version addition causing whole json object mock to fail in tests Signed-off-by: Afreen Misbah --- diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py index 68dd8440b7f4..ca15df5245c0 100644 --- a/src/pybind/mgr/dashboard/controllers/host.py +++ b/src/pybind/mgr/dashboard/controllers/host.py @@ -146,7 +146,7 @@ def get_hosts(sources=None): hosts = [ merge_dicts( { - 'ceph_version': '', + 'ceph_version': mgr.version, 'services': [], 'sources': { 'ceph': False, diff --git a/src/pybind/mgr/dashboard/tests/test_host.py b/src/pybind/mgr/dashboard/tests/test_host.py index 8a86d3b4ba52..99fd6ce3d84b 100644 --- a/src/pybind/mgr/dashboard/tests/test_host.py +++ b/src/pybind/mgr/dashboard/tests/test_host.py @@ -187,6 +187,7 @@ class HostControllerTest(ControllerTestCase): def test_get_3(self): mgr.list_servers.return_value = [] + mgr.version = 'ceph version 16.0.0-3151-gf202994fcf' with patch_orch(True, hosts=[HostSpec('node1')]): self._get('{}/node1'.format(self.URL_HOST)) @@ -197,6 +198,7 @@ class HostControllerTest(ControllerTestCase): def test_populate_service_instances(self): mgr.list_servers.return_value = [] + mgr.version = 'ceph version 16.0.0-3151-gf202994fcf' node1_daemons = [ DaemonDescription(