From 7fbc45e4e4399085873f6495ce357278cadf9671 Mon Sep 17 00:00:00 2001 From: Red_M Date: Sun, 20 May 2018 19:13:32 +1000 Subject: Add SSH configs as per #429. --- pexpect/pxssh.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'pexpect') diff --git a/pexpect/pxssh.py b/pexpect/pxssh.py index 79cf7f2..2f22ace 100644 --- a/pexpect/pxssh.py +++ b/pexpect/pxssh.py @@ -259,7 +259,7 @@ class pxssh (spawn): sync_multiplier=1, check_local_ip=True, password_regex=r'(?i)(?:password:)|(?:passphrase for key)', ssh_tunnels={}, spawn_local_ssh=True, - sync_original_prompt=True): + sync_original_prompt=True, ssh_config=None): '''This logs the user into the given server. It uses @@ -312,6 +312,14 @@ class pxssh (spawn): ssh_options = ssh_options + " -o'NoHostAuthenticationForLocalhost=yes'" if self.force_password: ssh_options = ssh_options + ' ' + self.SSH_OPTS + if ssh_config is not None: + if spawn_local_ssh: + try: + if spawn_local_ssh: + os.path.isfile(ssh_config) + except: + raise ExceptionPxssh('SSH config does not exist') + ssh_options = ssh_options + ssh_config if port is not None: ssh_options = ssh_options + ' -p %s'%(str(port)) if ssh_key is not None: -- cgit v1.2.1