From 87459b196820d263781bda383700e66e21a28ea6 Mon Sep 17 00:00:00 2001 From: Kiefer Chang Date: Tue, 12 Nov 2019 12:47:04 +0800 Subject: [PATCH] Fix backend testing error due to attribute rename `id` in Device is renamed to `path`. Signed-off-by: Kiefer Chang --- src/pybind/mgr/dashboard/controllers/orchestrator.py | 2 +- src/pybind/mgr/dashboard/tests/test_orchestrator.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/orchestrator.py b/src/pybind/mgr/dashboard/controllers/orchestrator.py index d2d2e1f9978d0..06011a4037023 100644 --- a/src/pybind/mgr/dashboard/controllers/orchestrator.py +++ b/src/pybind/mgr/dashboard/controllers/orchestrator.py @@ -81,7 +81,7 @@ class OrchestratorInventory(RESTController): node_osds = device_osd_map.get(inventory_node['name']) for device in inventory_node['devices']: if node_osds: - device['osd_ids'] = sorted(node_osds.get(device['id'], [])) + device['osd_ids'] = sorted(node_osds.get(device['path'], [])) else: device['osd_ids'] = [] return inventory_nodes diff --git a/src/pybind/mgr/dashboard/tests/test_orchestrator.py b/src/pybind/mgr/dashboard/tests/test_orchestrator.py index 8fa191a51dbca..9e44ea74fdce6 100644 --- a/src/pybind/mgr/dashboard/tests/test_orchestrator.py +++ b/src/pybind/mgr/dashboard/tests/test_orchestrator.py @@ -4,8 +4,6 @@ try: except ImportError: from unittest import mock -from ceph.deployment.inventory import Devices - from orchestrator import InventoryNode, ServiceDescription from . import ControllerTestCase @@ -68,16 +66,16 @@ class OrchestratorControllerTest(ControllerTestCase): { 'name': 'host-0', 'devices': [ - {'id': 'nvme0n1'}, - {'id': 'sdb'}, - {'id': 'sdc'}, + {'path': 'nvme0n1'}, + {'path': 'sdb'}, + {'path': 'sdc'}, ] }, { 'name': 'host-1', 'devices': [ - {'id': 'sda'}, - {'id': 'sdb'}, + {'path': 'sda'}, + {'path': 'sdb'}, ] } ] -- 2.39.5