@@ -481,19 +481,16 @@ def _santizie_condition(self, split):
481481 found_all_keys_matcher = False
482482 if 'conditions' not in split or split ['conditions' ] is None :
483483 split ['conditions' ] = []
484- conditions_count = len (split ['conditions' ])
485- count = 0
486- for condition in split ['conditions' ]:
487- count += 1
488- if count == conditions_count : # checking only last condition
489- if 'conditionType' in condition :
490- if condition ['conditionType' ] == 'ROLLOUT' :
491- if 'matcherGroup' in condition :
492- if 'matchers' in condition ['matcherGroup' ]:
493- for matcher in condition ['matcherGroup' ]['matchers' ]:
494- if matcher ['matcherType' ] == 'ALL_KEYS' :
495- found_all_keys_matcher = True
496- break
484+ if len (split ['conditions' ]) > 0 :
485+ last_condition = split ['conditions' ][- 1 ]
486+ if 'conditionType' in last_condition :
487+ if last_condition ['conditionType' ] == 'ROLLOUT' :
488+ if 'matcherGroup' in last_condition :
489+ if 'matchers' in last_condition ['matcherGroup' ]:
490+ for matcher in last_condition ['matcherGroup' ]['matchers' ]:
491+ if matcher ['matcherType' ] == 'ALL_KEYS' :
492+ found_all_keys_matcher = True
493+ break
497494
498495 if not found_all_keys_matcher :
499496 _LOGGER .debug ("Missing default rule condition for split: %s, adding default rule with 100%% off treatment" , split ['name' ])
0 commit comments