From b8bdf7a03534123d61ea9efca0d018417d26fe51 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 25 Jun 2021 15:15:18 +0200 Subject: [PATCH] outposts: fix outpost being re-created when in host mode Signed-off-by: Jens Langhammer --- authentik/outposts/controllers/docker.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/authentik/outposts/controllers/docker.py b/authentik/outposts/controllers/docker.py index fc1e785574..aa7a6781e5 100644 --- a/authentik/outposts/controllers/docker.py +++ b/authentik/outposts/controllers/docker.py @@ -56,9 +56,15 @@ class DockerController(BaseController): def _comp_ports(self, container: Container) -> bool: """Check that the container has the correct ports exposed. Return true if container needs to be rebuilt.""" + # with TEST enabled, we use host-network + if settings.TEST: + return False + # When the container isn't running, the API doesn't report any port mappings + if container.status != "running": + return False # {'6379/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '6379'}]} for port in self.deployment_ports: - key = f"{port.inner_port or port.port}/{port.protocol}" + key = f"{port.inner_port or port.port}/{port.protocol.lower()}" if key not in container.ports: return True host_matching = False