Make meta optional

This commit is contained in:
Mark Veidemanis 2023-01-16 07:20:37 +00:00
parent 4aa8e67e11
commit 7b05e48d71
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 3 additions and 4 deletions

View File

@ -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)