Skip to content

Commit d3da6e2

Browse files
remote/client: fix forwarding of remote ports
'labgrid-client forward --remote' accidentally uses the variable 'localport', which is either not set at all (leading to a UnboundLocalError) if no --local/-L is set or is set to the LOCAL part of --local/-L, which is wrong. The LOCAL part of --remote/-R should be used instead. Fix that by using the correct variable 'local'. Note that the informational print used the correct variable already. Fixes: 51f3fe5 ("client: Add port forwarding") Signed-off-by: Bastian Krause <[email protected]>
1 parent dc8392a commit d3da6e2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Bug fixes in 0.5.0
1010

1111
- Fixed a bug where using ``labgrid-client io get`` always returned ``low``
1212
when reading a ``sysfsgpio``.
13+
- Fixed ``labgrid-client forward --remote``/``-R``, which used either the LOCAL
14+
part of ``--local``/``-L`` accidentally (if specified) or raised an
15+
UnboundLocalError.
1316

1417
Breaking changes in 0.5.0
1518
~~~~~~~~~~~~~~~~~~~~~~~~~

labgrid/remote/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ def forward(self):
11211121
print(f"Forwarding local port {localport:d} to remote port {remote:d}")
11221122

11231123
for local, remote in self.args.remote:
1124-
stack.enter_context(drv.forward_remote_port(remote, localport))
1124+
stack.enter_context(drv.forward_remote_port(remote, local))
11251125
print(f"Forwarding remote port {remote:d} to local port {local:d}")
11261126

11271127
try:

0 commit comments

Comments
 (0)