Skip to content

Commit

Permalink
dont always try to pull the image
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <[email protected]>
  • Loading branch information
BeryJu committed Jan 16, 2025
1 parent d1fbf2e commit b7c154c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions authentik/outposts/controllers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from structlog.stdlib import get_logger
from yaml import safe_dump

from authentik import __version__
from authentik.outposts.apps import MANAGED_OUTPOST
from authentik.outposts.controllers.base import BaseClient, BaseController, ControllerException
from authentik.outposts.docker_ssh import DockerInlineSSH, SSHManagedExternallyException
Expand Down Expand Up @@ -182,10 +183,16 @@ def try_pull_image(self):
`outposts.container_image_base`, but fall back to known-good images"""
image = self.get_container_image()
try:
self.client.images.pull(image)
except DockerException: # pragma: no cover
image = f"ghcr.io/goauthentik/{self.outpost.type}:latest"
self.client.images.pull(image)
# See if the image exists...
self.client.images.get(image)
except DockerException:
try:
# ...otherwise try to pull it...
self.client.images.pull(image)
except DockerException:
# ...and as a fallback to that default to a sane standard
image = f"ghcr.io/goauthentik/{self.outpost.type}:{__version__}"
self.client.images.pull(image)
return image

def _get_container(self) -> tuple[Container, bool]:
Expand Down

0 comments on commit b7c154c

Please sign in to comment.