From 9939db13c31e962aeaa04bd7ca9e7213e18ba34c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 14 May 2021 11:13:04 +0200 Subject: [PATCH] outposts: fix reload notification not working due to wrong ID being saved Signed-off-by: Jens Langhammer --- authentik/outposts/channels.py | 1 + authentik/outposts/models.py | 1 + authentik/outposts/tasks.py | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/authentik/outposts/channels.py b/authentik/outposts/channels.py index f084b4a3d..f29a49e22 100644 --- a/authentik/outposts/channels.py +++ b/authentik/outposts/channels.py @@ -77,6 +77,7 @@ class OutpostConsumer(AuthJsonConsumer): self.last_uid = uid state = OutpostState( uid=uid, + channel_id=self.channel_name, last_seen=datetime.now(), _outpost=self.outpost, ) diff --git a/authentik/outposts/models.py b/authentik/outposts/models.py index c7de05794..85a1b674e 100644 --- a/authentik/outposts/models.py +++ b/authentik/outposts/models.py @@ -409,6 +409,7 @@ class OutpostState: """Outpost instance state, last_seen and version""" uid: str + channel_id: str last_seen: Optional[datetime] = field(default=None) version: Optional[str] = field(default=None) version_should: Union[Version, LegacyVersion] = field(default=OUR_VERSION) diff --git a/authentik/outposts/tasks.py b/authentik/outposts/tasks.py index 982acfbee..b3f2fb1f7 100644 --- a/authentik/outposts/tasks.py +++ b/authentik/outposts/tasks.py @@ -200,8 +200,8 @@ def _outpost_single_update(outpost: Outpost, layer=None): if not layer: # pragma: no cover layer = get_channel_layer() for state in OutpostState.for_outpost(outpost): - LOGGER.debug("sending update", channel=state.uid, outpost=outpost) - async_to_sync(layer.send)(state.uid, {"type": "event.update"}) + LOGGER.debug("sending update", channel=state.channel_id, outpost=outpost) + async_to_sync(layer.send)(state.channel_id, {"type": "event.update"}) @CELERY_APP.task()