summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRed_M <pooatyou.com@gmail.com>2018-05-20 19:28:30 +1000
committerRed_M <pooatyou.com@gmail.com>2018-05-20 19:28:30 +1000
commite9af652cab7d564f3799c9a6f5de5ac6922d217c (patch)
tree16a9a370226ab61e52783b405f8424120bf96eb0
parentde75d14a842027d28e1468de99083aa2f9382670 (diff)
downloadpexpect-git-e9af652cab7d564f3799c9a6f5de5ac6922d217c.tar.gz
Add test cases for #429 and fix feature for #429.
-rw-r--r--pexpect/pxssh.py2
-rw-r--r--tests/test_pxssh.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/pexpect/pxssh.py b/pexpect/pxssh.py
index 27e6cbb..3adeaab 100644
--- a/pexpect/pxssh.py
+++ b/pexpect/pxssh.py
@@ -324,7 +324,7 @@ class pxssh (spawn):
os.path.isfile(ssh_config)
except:
raise ExceptionPxssh('SSH config does not exist')
- ssh_options = ssh_options + ssh_config
+ ssh_options = ssh_options + '-F ' + ssh_config
if port is not None:
ssh_options = ssh_options + ' -p %s'%(str(port))
if ssh_key is not None:
diff --git a/tests/test_pxssh.py b/tests/test_pxssh.py
index 285ec73..452e997 100644
--- a/tests/test_pxssh.py
+++ b/tests/test_pxssh.py
@@ -85,6 +85,13 @@ class PxsshTestCase(SSHTestBase):
if confirmation_strings!=len(confirmation_array):
assert False, 'String generated from remote tunneling is incorrect.'
+ def test_ssh_config_passing_string(self):
+ ssh = pxssh.pxssh(debug_command_string=True)
+ config_path = '/fakepath/fake/config_file'
+ string = ssh.login('server', 'me', password='s3cret', spawn_local_ssh=False, ssh_config=config_path)
+ if not '-F '+config_path in string:
+ assert False, 'String generated from SSH config passing is incorrect.'
+
def test_ssh_key_string(self):
ssh = pxssh.pxssh(debug_command_string=True)
confirmation_strings = 0