From 80d0b14bb821ce5753f5d70a0e1a88d044cc591c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 20 Dec 2021 19:44:08 +0100 Subject: [PATCH] outposts: fix error when getting state for non-existent outpost Signed-off-by: Jens Langhammer --- authentik/lib/sentry.py | 1 + authentik/outposts/models.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/authentik/lib/sentry.py b/authentik/lib/sentry.py index 893d88ea4..3d69a7b2d 100644 --- a/authentik/lib/sentry.py +++ b/authentik/lib/sentry.py @@ -109,6 +109,7 @@ def before_send(event: dict, hint: dict) -> Optional[dict]: "django_redis", "django.security.DisallowedHost", "django_redis.cache", + "celery.backends.redis", ]: return None LOGGER.debug("sending event to sentry", exc=exc_value, source_logger=event.get("logger", None)) diff --git a/authentik/outposts/models.py b/authentik/outposts/models.py index 8ba06eb77..a4300df19 100644 --- a/authentik/outposts/models.py +++ b/authentik/outposts/models.py @@ -481,6 +481,8 @@ class OutpostState: def for_outpost(outpost: Outpost) -> list["OutpostState"]: """Get all states for an outpost""" keys = cache.keys(f"{outpost.state_cache_prefix}_*") + if not keys: + return [] states = [] for key in keys: instance_uid = key.replace(f"{outpost.state_cache_prefix}_", "")