Commit ccb01814 authored by azarchs's avatar azarchs Committed by Commit bot

Make startup of of WPR components resilient to not starting up previous steps.

This fixes the redness in the orderfile bot due to the WPR server failing to
start due to certs not being installed.

Review URL: https://codereview.chromium.org/1089163004

Cr-Commit-Position: refs/heads/master@{#325229}
parent a11355db
......@@ -135,12 +135,14 @@ class WprManager(object):
"""Start the WPR server on the host and the forwarder on the device."""
print 'Starting WPR on host...'
_DownloadFromCloudStorage(self._WPR_BUCKET, self._wpr_archive_hash)
self._wpr_server = webpagereplay.ReplayServer(self._wpr_archive,
'127.0.0.1', 0, 0, None,
['--should_generate_certs',
'--https_root_ca_cert_path=' + self._wpr_ca_cert_path,
'--use_closest_match'])
ports = self._wpr_server.StartServer()[:-1]
args = ['--user_closest_match']
if self._is_test_ca_installed:
args.extend(['--should_generate_certs',
'--https_root_ca_cert_path=' + self._wpr_ca_cert_path])
wpr_server = webpagereplay.ReplayServer(self._wpr_archive,
'127.0.0.1', 0, 0, None, args)
ports = wpr_server.StartServer()[:-1]
self._wpr_server = wpr_server
self._host_http_port = ports[0]
self._host_https_port = ports[1]
......@@ -149,11 +151,15 @@ class WprManager(object):
print 'Stopping WPR on host...'
if self._wpr_server:
self._wpr_server.StopServer()
self._wpr_server = None
def _StartForwarder(self):
"""Sets up forwarding of device ports to the host, and configures chrome
to use those ports.
"""
if not self._wpr_server:
logging.warning('No host WPR server to forward to.')
return
print 'Starting device forwarder...'
forwarder.Forwarder.Map([(0, self._host_http_port),
(0, self._host_https_port)],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment