1f079cfbe45eb522c04170acf91422933b29f713cbeeps# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2f079cfbe45eb522c04170acf91422933b29f713cbeeps# Use of this source code is governed by a BSD-style license that can be 3f079cfbe45eb522c04170acf91422933b29f713cbeeps# found in the LICENSE file. 4f079cfbe45eb522c04170acf91422933b29f713cbeeps 5f079cfbe45eb522c04170acf91422933b29f713cbeepsimport logging 6f079cfbe45eb522c04170acf91422933b29f713cbeeps 7f079cfbe45eb522c04170acf91422933b29f713cbeepsfrom autotest_lib.server import test 8f079cfbe45eb522c04170acf91422933b29f713cbeepsfrom autotest_lib.server.hosts import cros_host 9f079cfbe45eb522c04170acf91422933b29f713cbeeps 10f079cfbe45eb522c04170acf91422933b29f713cbeeps 11f079cfbe45eb522c04170acf91422933b29f713cbeepsclass provision_FactoryImage(test.test): 12f079cfbe45eb522c04170acf91422933b29f713cbeeps """Installs a specified factory image onto a servo-connected DUT.""" 13f079cfbe45eb522c04170acf91422933b29f713cbeeps version = 1 14f079cfbe45eb522c04170acf91422933b29f713cbeeps 15f079cfbe45eb522c04170acf91422933b29f713cbeeps def run_once(self, host, image_url): 16f079cfbe45eb522c04170acf91422933b29f713cbeeps """Install image from URL `image_url` on `host`. 17f079cfbe45eb522c04170acf91422933b29f713cbeeps 18f079cfbe45eb522c04170acf91422933b29f713cbeeps @param host Host object representing DUT to be re-imaged. 19f079cfbe45eb522c04170acf91422933b29f713cbeeps @param image_url URL of a test image to be installed. 20f079cfbe45eb522c04170acf91422933b29f713cbeeps """ 21f079cfbe45eb522c04170acf91422933b29f713cbeeps logging.info('Installing image from url %s', image_url) 22f079cfbe45eb522c04170acf91422933b29f713cbeeps #TODO(beeps): once crbug.com/259126 is resolved apply a label. 23f079cfbe45eb522c04170acf91422933b29f713cbeeps host.servo_install( 24f079cfbe45eb522c04170acf91422933b29f713cbeeps image_url=image_url, 25f079cfbe45eb522c04170acf91422933b29f713cbeeps usb_boot_timeout=cros_host.CrosHost.USB_BOOT_TIMEOUT*3, 26f079cfbe45eb522c04170acf91422933b29f713cbeeps install_timeout=cros_host.CrosHost.INSTALL_TIMEOUT*2) 27