From ee83a17a8e24da9c0278cc4706b7241c3d1ce080 Mon Sep 17 00:00:00 2001 From: Prashant D Date: Wed, 2 Sep 2020 08:33:16 -0400 Subject: [PATCH] mgr/mgr_module: fix keyerror for op If rule steps first element is opcode. Fixes : https://tracker.ceph.com/issues/47272 Signed-off-by: Prashant Dhange --- src/pybind/mgr/mgr_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 9e8c3ba4ca6fb6..6313de25725e23 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -234,7 +234,7 @@ def get_rule_root(self, rule_name): return None try: - first_take = [s for s in rule['steps'] if s['op'] == 'take'][0] + first_take = [s for s in rule['steps'] if 'op' in s and s['op'] == 'take'][0] except IndexError: logging.warning("CRUSH rule '{0}' has no 'take' step".format( rule_name))