Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: telemetry/telemetry/internal/forwarders/cros_forwarder.py

Issue 2335403003: Reland of "[telemetry] Wire TsProxy through telemetry's network stack." (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/forwarders/cros_forwarder.py
diff --git a/telemetry/telemetry/internal/forwarders/cros_forwarder.py b/telemetry/telemetry/internal/forwarders/cros_forwarder.py
index 86c5a7aa654168b9486d8159aa39ad155e6f6a3b..d8a9ab32065379a7ca16b3e71b36ef13aa29cc98 100644
--- a/telemetry/telemetry/internal/forwarders/cros_forwarder.py
+++ b/telemetry/telemetry/internal/forwarders/cros_forwarder.py
@@ -17,20 +17,20 @@
self._cri = cri
# pylint: disable=arguments-differ
- def Create(self, port_pair, use_remote_port_forwarding=True):
+ def Create(self, port_pairs, use_remote_port_forwarding=True):
if self._cri.local:
- return do_nothing_forwarder.DoNothingForwarder(port_pair)
- return CrOsSshForwarder(self._cri, use_remote_port_forwarding, port_pair)
+ return do_nothing_forwarder.DoNothingForwarder(port_pairs)
+ return CrOsSshForwarder(self._cri, use_remote_port_forwarding, port_pairs)
class CrOsSshForwarder(forwarders.Forwarder):
- def __init__(self, cri, use_remote_port_forwarding, port_pair):
- super(CrOsSshForwarder, self).__init__(port_pair)
+ def __init__(self, cri, use_remote_port_forwarding, port_pairs):
+ super(CrOsSshForwarder, self).__init__(port_pairs)
self._cri = cri
self._proc = None
forwarding_args = self._ForwardingArgs(
- use_remote_port_forwarding, self.host_ip, port_pair)
+ use_remote_port_forwarding, self.host_ip, port_pairs)
self._proc = subprocess.Popen(
self._cri.FormSSHCommandLine(['sleep', '999999999'], forwarding_args),
stdout=subprocess.PIPE,
@@ -43,18 +43,16 @@
# pylint: disable=unused-argument
@staticmethod
- def _ForwardingArgs(use_remote_port_forwarding, host_ip, port_pair):
+ def _ForwardingArgs(use_remote_port_forwarding, host_ip, port_pairs):
if use_remote_port_forwarding:
- arg_format = '-R{remote_port}:{host_ip}:{local_port}'
+ arg_format = '-R{pp.remote_port}:{host_ip}:{pp.local_port}'
else:
- arg_format = '-L{local_port}:{host_ip}:{remote_port}'
- return [arg_format.format(host_ip=host_ip,
- local_port=port_pair.local_port,
- remote_port=port_pair.remote_port)]
+ arg_format = '-L{pp.local_port}:{host_ip}:{pp.remote_port}'
+ return [arg_format.format(**locals()) for pp in port_pairs if pp]
@property
def host_port(self):
- return self._port_pair.remote_port
+ return self._port_pairs.http.remote_port
def Close(self):
if self._proc:

Powered by Google App Engine
This is Rietveld 408576698