From dbc3df1f63c19f57124fbaf13c12f53747d39ed1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 3 May 2021 22:52:35 +0200 Subject: [PATCH] events: handle error when notification rule doesn't exist during task Signed-off-by: Jens Langhammer --- authentik/events/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authentik/events/tasks.py b/authentik/events/tasks.py index 9822bf02c..69c84a6fa 100644 --- a/authentik/events/tasks.py +++ b/authentik/events/tasks.py @@ -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"]