fix error handling

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-04-24 16:15:01 +03:00
parent 71ac1282f9
commit d5708d22e0
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,5 @@
"""Docker controller""" """Docker controller"""
from subprocess import SubprocessError
from time import sleep from time import sleep
from typing import Optional from typing import Optional
from urllib.parse import urlparse from urllib.parse import urlparse
@ -9,7 +10,6 @@ from docker import DockerClient as UpstreamDockerClient
from docker.errors import DockerException, NotFound from docker.errors import DockerException, NotFound
from docker.models.containers import Container from docker.models.containers import Container
from docker.utils.utils import kwargs_from_env from docker.utils.utils import kwargs_from_env
from paramiko.ssh_exception import SSHException
from structlog.stdlib import get_logger from structlog.stdlib import get_logger
from yaml import safe_dump from yaml import safe_dump
@ -60,7 +60,7 @@ class DockerClient(UpstreamDockerClient, BaseClient):
tls=tls_config, tls=tls_config,
use_ssh_client=True, use_ssh_client=True,
) )
except SSHException as exc: except SubprocessError as exc:
if self.ssh: if self.ssh:
self.ssh.cleanup() self.ssh.cleanup()
raise ServiceConnectionInvalid(exc) from exc raise ServiceConnectionInvalid(exc) from exc

View File

@ -9,6 +9,7 @@ from authentik.crypto.models import CertificateKeyPair
SSH_CONFIG_DIR = Path("/etc/ssh/ssh_config.d/") SSH_CONFIG_DIR = Path("/etc/ssh/ssh_config.d/")
def opener(path, flags): def opener(path, flags):
"""File opener to create files as 700 perms""" """File opener to create files as 700 perms"""
return os.open(path, flags, 0o700) return os.open(path, flags, 0o700)