diff options
author | Alexander D. Kanevskiy <kad@kad.name> | 2014-05-10 02:46:39 +0300 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2014-05-29 17:18:53 +0900 |
commit | dcce12afe6140dea28d847f04baaf05ecefaa8ec (patch) | |
tree | ee1c2a1cf32af2fa255f118197148c29f298ab0d | |
parent | ae245199e35b0cbd996df427b449694d5cedffac (diff) | |
download | pygerrit-dcce12afe6140dea28d847f04baaf05ecefaa8ec.tar.gz |
Add support for ProxyCommand in GerritSSHClient0.2.6
Change-Id: I776a58b2cdac17e3eafc985ee727cd88e8294ccc
-rw-r--r-- | pygerrit/ssh.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pygerrit/ssh.py b/pygerrit/ssh.py index 2933ddf..3ffa97b 100644 --- a/pygerrit/ssh.py +++ b/pygerrit/ssh.py @@ -29,7 +29,7 @@ from threading import Event, Lock from .error import GerritError -from paramiko import SSHClient, SSHConfig +from paramiko import SSHClient, SSHConfig, ProxyCommand from paramiko.ssh_exception import SSHException @@ -75,6 +75,7 @@ class GerritSSHClient(SSHClient): self.port = port self.connected = Event() self.lock = Lock() + self.proxy = None def _configure(self): """ Configure the ssh parameters from the config file. """ @@ -102,6 +103,8 @@ class GerritSSHClient(SSHClient): self.port = int(data['port']) except ValueError: raise GerritError("Invalid port: %s" % data['port']) + if 'proxycommand' in data: + self.proxy = ProxyCommand(data['proxycommand']) def _do_connect(self): """ Connect to the remote. """ @@ -112,7 +115,8 @@ class GerritSSHClient(SSHClient): self.connect(hostname=self.hostname, port=self.port, username=self.username, - key_filename=self.key_filename) + key_filename=self.key_filename, + sock=self.proxy) except socket.error as e: raise GerritError("Failed to connect to server: %s" % e) |