From: Boris Ranto Date: Thu, 14 Feb 2019 09:35:56 +0000 (+0100) Subject: restful: Fix regression when traversing leaf nodes X-Git-Tag: v13.2.5~6^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e1b7aeb330e65500072dc7c5f0446512ccbdbc4d;p=ceph.git 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 (cherry picked from commit fb51bad963cc649fb12ca0ed8b738a2e819299b6) --- diff --git a/src/pybind/mgr/restful/common.py b/src/pybind/mgr/restful/common.py index 2ca482d581d6..2c1ffddaea35 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