From fb51bad963cc649fb12ca0ed8b738a2e819299b6 Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Thu, 14 Feb 2019 10:35:56 +0100 Subject: [PATCH] restful: Fix regression when traversing leaf nodes The commit 23b6c90 introduced a regression when traversing leaf nodes. The issue is that it traverses the keys of a `dict` returned by `nodes_by_id`, not the actual `items` of the node. That resulted in an 500 error because it tried to treat `str` as a `dict` and failed. Signed-off-by: Boris Ranto --- src/pybind/mgr/restful/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/restful/common.py b/src/pybind/mgr/restful/common.py index 0ab71e3f9d4..6eb3e416a80 100644 --- a/src/pybind/mgr/restful/common.py +++ b/src/pybind/mgr/restful/common.py @@ -142,7 +142,7 @@ def crush_rule_osds(node_buckets, rule): if node_id >= 0: osds.add(node_id) else: - for desc_node in nodes_by_id[node_id]: + for desc_node in nodes_by_id[node_id]['items']: # Short circuit another iteration to find the emit # and assume anything we've done a chooseleaf on # is going to be part of the selected set of osds -- 2.39.5