OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from autotest_lib.client.common_lib import chromiumos_updater, global_config | 5 from autotest_lib.client.common_lib import global_config |
| 6 from autotest_lib.client.common_lib.cros import autoupdater |
6 from autotest_lib.server import autoserv_parser | 7 from autotest_lib.server import autoserv_parser |
7 from autotest_lib.server.hosts import base_classes | 8 from autotest_lib.server.hosts import base_classes |
8 | 9 |
9 | 10 |
10 parser = autoserv_parser.autoserv_parser | 11 parser = autoserv_parser.autoserv_parser |
11 | 12 |
12 | 13 |
13 class ChromiumOSHost(base_classes.Host): | 14 class ChromiumOSHost(base_classes.Host): |
14 """ChromiumOSHost is a special subclass of SSHHost that supports | 15 """ChromiumOSHost is a special subclass of SSHHost that supports |
15 additional install methods. | 16 additional install methods. |
16 """ | 17 """ |
17 def __initialize(self, hostname, *args, **dargs): | 18 def __initialize(self, hostname, *args, **dargs): |
18 """ | 19 """ |
19 Construct a ChromiumOSHost object | 20 Construct a ChromiumOSHost object |
20 | 21 |
21 Args: | 22 Args: |
22 hostname: network hostname or address of remote machine | 23 hostname: network hostname or address of remote machine |
23 """ | 24 """ |
24 super(ChromiumOSHost, self)._initialize(hostname, *args, **dargs) | 25 super(ChromiumOSHost, self)._initialize(hostname, *args, **dargs) |
25 | 26 |
26 | 27 |
27 def machine_install(self, update_url=None): | 28 def machine_install(self, update_url=None): |
28 # TODO(seano): Once front-end changes are in, Kill this entire | 29 # TODO(seano): Once front-end changes are in, Kill this entire |
29 # cmdline flag; It doesn't match the Autotest workflow. | 30 # cmdline flag; It doesn't match the Autotest workflow. |
30 if parser.options.image: | 31 if parser.options.image: |
31 update_url=parser.options.image | 32 update_url=parser.options.image |
32 elif not update_url: | 33 elif not update_url: |
33 return False | 34 return False |
34 updater = chromiumos_updater.ChromiumOSUpdater(host=self, | 35 updater = autoupdater.ChromiumOSUpdater(host=self, |
35 update_url=update_url) | 36 update_url=update_url) |
36 updater.run_update() | 37 updater.run_update() |
37 # Updater has returned, successfully, reboot the host. | 38 # Updater has returned, successfully, reboot the host. |
38 self.reboot(timeout=60, wait=True) | 39 self.reboot(timeout=60, wait=True) |
39 # Following the reboot, verify the correct version. | 40 # Following the reboot, verify the correct version. |
40 updater.check_version() | 41 updater.check_version() |
41 | 42 |
42 # Clean up any old autotest directories which may be lying around. | 43 # Clean up any old autotest directories which may be lying around. |
43 for path in global_config.global_config.get_config_value( | 44 for path in global_config.global_config.get_config_value( |
44 'AUTOSERV', 'client_autodir_paths', type=list): | 45 'AUTOSERV', 'client_autodir_paths', type=list): |
45 self.run('rm -rf ' + path) | 46 self.run('rm -rf ' + path) |
46 | 47 |
47 self.run('rm -rf ' + global_config.global_config.get_config_value( | 48 self.run('rm -rf ' + global_config.global_config.get_config_value( |
48 'AUTOSERV', 'client_autodir_real_path', type=str)) | 49 'AUTOSERV', 'client_autodir_real_path', type=str)) |
OLD | NEW |