From d5708d22e03d0f76430404979af132722ea1cd57 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 24 Apr 2023 16:15:01 +0300 Subject: [PATCH] fix error handling Signed-off-by: Jens Langhammer --- authentik/outposts/controllers/docker.py | 4 ++-- authentik/outposts/docker_ssh.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/authentik/outposts/controllers/docker.py b/authentik/outposts/controllers/docker.py index 28da249da..3f54ab910 100644 --- a/authentik/outposts/controllers/docker.py +++ b/authentik/outposts/controllers/docker.py @@ -1,4 +1,5 @@ """Docker controller""" +from subprocess import SubprocessError from time import sleep from typing import Optional from urllib.parse import urlparse @@ -9,7 +10,6 @@ from docker import DockerClient as UpstreamDockerClient from docker.errors import DockerException, NotFound from docker.models.containers import Container from docker.utils.utils import kwargs_from_env -from paramiko.ssh_exception import SSHException from structlog.stdlib import get_logger from yaml import safe_dump @@ -60,7 +60,7 @@ class DockerClient(UpstreamDockerClient, BaseClient): tls=tls_config, use_ssh_client=True, ) - except SSHException as exc: + except SubprocessError as exc: if self.ssh: self.ssh.cleanup() raise ServiceConnectionInvalid(exc) from exc diff --git a/authentik/outposts/docker_ssh.py b/authentik/outposts/docker_ssh.py index bc4457153..fea1da490 100644 --- a/authentik/outposts/docker_ssh.py +++ b/authentik/outposts/docker_ssh.py @@ -9,6 +9,7 @@ from authentik.crypto.models import CertificateKeyPair SSH_CONFIG_DIR = Path("/etc/ssh/ssh_config.d/") + def opener(path, flags): """File opener to create files as 700 perms""" return os.open(path, flags, 0o700)