diff --git a/core/lib/rules.py b/core/lib/rules.py index 958960c..07423a5 100644 --- a/core/lib/rules.py +++ b/core/lib/rules.py @@ -138,9 +138,10 @@ def rule_notify(rule, index, message, meta=None): "rule": rule, "index": index, "message": message, - "matched": meta["aggs"], "notification_settings": notification_settings, } + if meta: + cast["matched"] = meta["aggs"] if rule.service == "ntfy": cast["msg"] = format_ntfy(**cast) @@ -308,9 +309,7 @@ class NotificationRuleData(object): if len(aggs_for_index) == len(self.aggs.keys()): if all(aggs_for_index): # All aggs have matched - self.rule_matched( - index, results[: self.object.amount], meta - ) + self.rule_matched(index, results[: self.object.amount], meta) continue # Default branch, since the happy path has a continue keyword self.rule_no_match(index)