use open
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
609e9a00b4
commit
bc6d66cd88
|
@ -32,12 +32,13 @@ class DockerInlineSSH:
|
||||||
self.host = host
|
self.host = host
|
||||||
self.keypair = keypair
|
self.keypair = keypair
|
||||||
self.config_path = SSH_CONFIG_DIR / Path(self.host + ".conf")
|
self.config_path = SSH_CONFIG_DIR / Path(self.host + ".conf")
|
||||||
if not open(self.config_path, "w").writable():
|
with open(self.config_path, "w", encoding="utf-8") as _config:
|
||||||
# SSH Config file already exists and there's no header from us, meaning that it's
|
if not _config.writable():
|
||||||
# been externally mapped into the container for more complex configs
|
# SSH Config file already exists and there's no header from us, meaning that it's
|
||||||
raise SSHManagedExternallyException(
|
# been externally mapped into the container for more complex configs
|
||||||
"SSH Config exists and does not contain authentik header"
|
raise SSHManagedExternallyException(
|
||||||
)
|
"SSH Config exists and does not contain authentik header"
|
||||||
|
)
|
||||||
if not self.keypair:
|
if not self.keypair:
|
||||||
raise DockerException("keypair must be set for SSH connections")
|
raise DockerException("keypair must be set for SSH connections")
|
||||||
|
|
||||||
|
|
Reference in New Issue