events: handle error when notification rule doesn't exist during task
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
07b001bc2b
commit
dbc3df1f63
|
@ -35,7 +35,10 @@ def event_trigger_handler(event_uuid: str, trigger_name: str):
|
|||
LOGGER.warning("event doesn't exist yet or anymore", event_uuid=event_uuid)
|
||||
return
|
||||
event: Event = events.first()
|
||||
trigger: NotificationRule = NotificationRule.objects.get(name=trigger_name)
|
||||
triggers: NotificationRule = NotificationRule.objects.filter(name=trigger_name)
|
||||
if not triggers.exists():
|
||||
return
|
||||
trigger = triggers.first()
|
||||
|
||||
if "policy_uuid" in event.context:
|
||||
policy_uuid = event.context["policy_uuid"]
|
||||
|
|
Reference in New Issue