Make meta optional
This commit is contained in:
parent
4aa8e67e11
commit
7b05e48d71
|
@ -138,9 +138,10 @@ def rule_notify(rule, index, message, meta=None):
|
||||||
"rule": rule,
|
"rule": rule,
|
||||||
"index": index,
|
"index": index,
|
||||||
"message": message,
|
"message": message,
|
||||||
"matched": meta["aggs"],
|
|
||||||
"notification_settings": notification_settings,
|
"notification_settings": notification_settings,
|
||||||
}
|
}
|
||||||
|
if meta:
|
||||||
|
cast["matched"] = meta["aggs"]
|
||||||
|
|
||||||
if rule.service == "ntfy":
|
if rule.service == "ntfy":
|
||||||
cast["msg"] = format_ntfy(**cast)
|
cast["msg"] = format_ntfy(**cast)
|
||||||
|
@ -308,9 +309,7 @@ class NotificationRuleData(object):
|
||||||
if len(aggs_for_index) == len(self.aggs.keys()):
|
if len(aggs_for_index) == len(self.aggs.keys()):
|
||||||
if all(aggs_for_index):
|
if all(aggs_for_index):
|
||||||
# All aggs have matched
|
# All aggs have matched
|
||||||
self.rule_matched(
|
self.rule_matched(index, results[: self.object.amount], meta)
|
||||||
index, results[: self.object.amount], meta
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
# Default branch, since the happy path has a continue keyword
|
# Default branch, since the happy path has a continue keyword
|
||||||
self.rule_no_match(index)
|
self.rule_no_match(index)
|
||||||
|
|
Loading…
Reference in New Issue