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 <[email protected]>
Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Sergio
2020-03-31 23:54:57 +03:00
committed by GitHub
co-authored by Sergio Garcia Ruslan Kuprieiev
parent d2ea180a9a
commit 60ace79305
+8
View File
@@ -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):