| #!/usr/bin/python3 |
| # |
| # Copyright 2015 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import logging |
| |
| from contextlib import closing |
| |
| from client.common_lib import error |
| from client.common_lib.cros import dev_server |
| from server import hosts |
| |
| # Url to server-side package staged on devserver. |
| ssp_url = None |
| # Error message raised by stage_server_side_package call. |
| error_msg = None |
| # Only need to stage server side package once. |
| for machine in machines: |
| try: |
| with closing(hosts.create_host(machine)) as host: |
| ssp_url = host.stage_server_side_package(image) |
| break |
| except (error.AutoservError, dev_server.DevServerException) as e: |
| error_msg = str(e) |
| logging.error('Stage server-side package failed. %s', e) |