Skip to content

Commit

Permalink
mgr/mgr_module: fix keyerror for op
Browse files Browse the repository at this point in the history
If rule steps first element is opcode.

Fixes : https://tracker.ceph.com/issues/47272

Signed-off-by: Prashant Dhange <pdhange@redhat.com>
  • Loading branch information
Prashant D committed Sep 3, 2020
1 parent 2fd4201 commit ee83a17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pybind/mgr/mgr_module.py
Expand Up @@ -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))
Expand Down

0 comments on commit ee83a17

Please sign in to comment.