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-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0af93023882bd0d53f8d223d953ebd977681747c;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 (cherry picked from commit 1aa74cf3fce6394ad08e83e91a90923d983b03c5) --- diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py index d2263b7323865..9681d45ab5b2c 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 8a86d3b4ba522..99fd6ce3d84b3 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(