Skip to content

Commit

Permalink
remote/client: use port from NetworkService for ssh call
Browse files Browse the repository at this point in the history
Since PR #342 NetworkService's IP/username/password are considered for
'labgrid-client ssh'. This also adds the SSH port.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
  • Loading branch information
Bastian-Krause authored and jluebbe committed Mar 4, 2019
1 parent af0788b commit d07357e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CHANGES.rst
Expand Up @@ -3,14 +3,17 @@ Release 0.3.0 (unreleased)

New Features in 0.3.0
~~~~~~~~~~~~~~~~~~~~~

- labgrid-client ``write-image`` subcommand: labgrid client now has a
``write-image`` command to write images onto block devices.
- ``labgrid-client ssh`` now also uses port from NetworkService resource if
available

Release 0.2.0 (released Jan 4, 2019)
------------------------------------

New Features
~~~~~~~~~~~~
New Features in 0.2.0
~~~~~~~~~~~~~~~~~~~~~

- A colored StepReporter was added and can be used with ``pytest
--lg-colored-steps``.
Expand Down
3 changes: 3 additions & 0 deletions labgrid/remote/client.py
Expand Up @@ -841,6 +841,7 @@ def ssh(self):
try:
resource = target.get_resource(NetworkService)
username = resource.username
port = resource.port or 22
# use sshpass if we have a password
if resource.password:
env['SSHPASS'] = resource.password
Expand All @@ -849,10 +850,12 @@ def ssh(self):
except NoResourceFoundError:
username = 'root'
sshpass = []
port = 22

args = sshpass + [
'ssh',
'-l', username,
'-p', str(port),
'-o', 'StrictHostKeyChecking no',
'-o', 'UserKnownHostsFile /dev/null',
str(ip),
Expand Down

0 comments on commit d07357e

Please sign in to comment.