Skip to content

Commit

Permalink
Set 22 as default remote_port (#275)
Browse files Browse the repository at this point in the history
Closes #246
  • Loading branch information
cristii006 authored and Mihai Pârvu committed Oct 30, 2018
1 parent ff89a21 commit dc636f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions atest/tunnels.robot
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Local Tunnel SSH
Login ${USERNAME} ${PASSWORD}
Execute Command ls

Local Tunnel With Default Remote Port
Login With Public Key ${KEY USERNAME} ${KEY}
Create Local SSH Tunnel ${LOCAL PORT} ${REMOTE HOST}
Port Should Not Be Free ${LOCAL PORT}

*** Keywords ***
Port Should Not Be Free
[Arguments] ${port}
Expand Down
4 changes: 3 additions & 1 deletion src/SSHLibrary/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ def read_command_output(self, return_stdout=True, return_stderr=False,
raise RuntimeError(msg)
return self._return_command_output(stdout, stderr, rc, *opts)

def create_local_ssh_tunnel(self, local_port, remote_host, remote_port):
def create_local_ssh_tunnel(self, local_port, remote_host, remote_port=22):
"""
The keyword uses the existing connection to set up local port forwarding
(the openssh -L option) from a local port through a tunneled
Expand All @@ -1113,6 +1113,8 @@ def create_local_ssh_tunnel(self, local_port, remote_host, remote_port):
The tunnel is active as long as the connection is open.
The default ``remote_port`` is 22.
New in SSHLibrary 3.1.0
"""
self.current.create_local_ssh_tunnel(local_port, remote_host, remote_port)
Expand Down

0 comments on commit dc636f3

Please sign in to comment.