outposts: remote docker ssh fixes (#3691)

* improve error logging for SSH connections

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* "fix" host key checking

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens L 2022-09-28 12:10:40 +02:00 committed by GitHub
parent 1169efaf97
commit df4200992c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -61,7 +61,9 @@ class DockerClient(UpstreamDockerClient, BaseClient):
tls=tls_config, tls=tls_config,
) )
except SSHException as exc: except SSHException as exc:
raise ServiceConnectionInvalid from exc if self.ssh:
self.ssh.cleanup()
raise ServiceConnectionInvalid(exc) from exc
# Ensure the client actually works # Ensure the client actually works
self.containers.list() self.containers.list()

View File

@ -38,7 +38,7 @@ class KubernetesClient(ApiClient, BaseClient):
load_kube_config_from_dict(connection.kubeconfig, client_configuration=config) load_kube_config_from_dict(connection.kubeconfig, client_configuration=config)
super().__init__(config) super().__init__(config)
except ConfigException as exc: except ConfigException as exc:
raise ServiceConnectionInvalid from exc raise ServiceConnectionInvalid(exc) from exc
def fetch_state(self) -> OutpostServiceConnectionState: def fetch_state(self) -> OutpostServiceConnectionState:
"""Get version info""" """Get version info"""

View File

@ -54,6 +54,8 @@ class DockerInlineSSH:
self.header, self.header,
f"Host {self.host}\n", f"Host {self.host}\n",
f" IdentityFile {key_path}\n", f" IdentityFile {key_path}\n",
" StrictHostKeyChecking No\n",
" UserKnownHostsFile /dev/null\n",
f"{FOOTER}\n", f"{FOOTER}\n",
"\n", "\n",
] ]