summaryrefslogtreecommitdiff
path: root/pexpect
diff options
context:
space:
mode:
authorRed_M <pooatyou.com@gmail.com>2018-05-20 19:13:32 +1000
committerRed_M <pooatyou.com@gmail.com>2018-05-20 19:13:32 +1000
commit7fbc45e4e4399085873f6495ce357278cadf9671 (patch)
tree3b6b169a503b5a441c886c2f95c1dfd7d283ac75 /pexpect
parent6b741f9152802aceb96d610cdedcff7a6378ec3f (diff)
downloadpexpect-git-7fbc45e4e4399085873f6495ce357278cadf9671.tar.gz
Add SSH configs as per #429.
Diffstat (limited to 'pexpect')
-rw-r--r--pexpect/pxssh.py10
1 files changed, 9 insertions, 1 deletions
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: