diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2019-04-15 13:55:24 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-15 13:55:24 +0900 |
commit | 756300120b0f4f4af19e0f985566d82bc80b4359 (patch) | |
tree | 32b2e21a35421d60c15fc848bfce0b040b553c8d /pygerrit/ssh.py | |
parent | 89578cb65abc4cdaa41304663ed9ef206794b681 (diff) | |
parent | c36cfd0b059fc2b3c8ab84db5179cc8c8e7143c6 (diff) | |
download | pygerrit-master.tar.gz |
Add support for automatically adding known_hosts
Diffstat (limited to 'pygerrit/ssh.py')
-rw-r--r-- | pygerrit/ssh.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pygerrit/ssh.py b/pygerrit/ssh.py index fbc5a29..03952e3 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, ProxyCommand +from paramiko import AutoAddPolicy, SSHClient, SSHConfig, ProxyCommand from paramiko.ssh_exception import SSHException @@ -65,7 +65,8 @@ class GerritSSHClient(SSHClient): """ Gerrit SSH Client, wrapping the paramiko SSH Client. """ - def __init__(self, hostname, username=None, port=None, keepalive=None): + def __init__(self, hostname, username=None, port=None, + keepalive=None, auto_add_hosts=False): """ Initialise and connect to SSH. """ super(GerritSSHClient, self).__init__() self.remote_version = None @@ -77,6 +78,8 @@ class GerritSSHClient(SSHClient): self.lock = Lock() self.proxy = None self.keepalive = keepalive + if auto_add_hosts: + self.set_missing_host_key_policy(AutoAddPolicy()) def _configure(self): """ Configure the ssh parameters from the config file. """ |