From 7b05e48d71c6ef7f1ee45867359e6b12dd582617 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 16 Jan 2023 07:20:37 +0000 Subject: [PATCH] Make meta optional --- core/lib/rules.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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)