From 60ace7930516b2f34b2692f376977d270594ed76 Mon Sep 17 00:00:00 2001 From: Sergio <37589160+gio8tisu@users.noreply.github.com> Date: Tue, 31 Mar 2020 22:54:57 +0200 Subject: [PATCH] remote: ADD sock attribute and pass it to SSHConnection constructor (#3562) * remote: ADD sock attribute and pass it to SSHConnection constructor The sock attribute is set to a `paramiko.ProxyCommand` object if 'ProxyCommand' exists in config to `None` other-wise (which is the default option in `paramiko.client.SSHClient.connect()`). FIXES #3560 * Move paramiko import to RemoteSSH __init__ * Update dvc/remote/ssh/__init__.py * Update dvc/remote/ssh/__init__.py * Update dvc/remote/ssh/__init__.py * Update dvc/remote/ssh/__init__.py Co-authored-by: Sergio Garcia Co-authored-by: Ruslan Kuprieiev --- dvc/remote/ssh/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dvc/remote/ssh/__init__.py b/dvc/remote/ssh/__init__.py index 703617b2a..ee4ad891c 100644 --- a/dvc/remote/ssh/__init__.py +++ b/dvc/remote/ssh/__init__.py @@ -85,6 +85,13 @@ class RemoteSSH(RemoteBASE): self.password = config.get("password", None) self.ask_password = config.get("ask_password", False) self.gss_auth = config.get("gss_auth", False) + proxy_command = user_ssh_config.get("proxycommand", False) + if proxy_command: + import paramiko + + self.sock = paramiko.ProxyCommand(proxy_command) + else: + self.sock = None @staticmethod def ssh_config_filename(): @@ -136,6 +143,7 @@ class RemoteSSH(RemoteBASE): timeout=self.timeout, password=self.password, gss_auth=self.gss_auth, + sock=self.sock, ) def exists(self, path_info):