| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Provisions Android devices with settings required for bots. | 7 """Provisions Android devices with settings required for bots. |
| 8 | 8 |
| 9 Usage: | 9 Usage: |
| 10 ./provision_devices.py [-d <device serial number>] | 10 ./provision_devices.py [-d <device serial number>] |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if step.reboot: | 163 if step.reboot: |
| 164 device.Reboot(False, retries=0) | 164 device.Reboot(False, retries=0) |
| 165 device.adb.WaitForDevice() | 165 device.adb.WaitForDevice() |
| 166 | 166 |
| 167 except device_errors.CommandTimeoutError: | 167 except device_errors.CommandTimeoutError: |
| 168 logger.exception('Timed out waiting for device %s. Adding to blacklist.', | 168 logger.exception('Timed out waiting for device %s. Adding to blacklist.', |
| 169 str(device)) | 169 str(device)) |
| 170 if blacklist: | 170 if blacklist: |
| 171 blacklist.Extend([str(device)], reason='provision_timeout') | 171 blacklist.Extend([str(device)], reason='provision_timeout') |
| 172 | 172 |
| 173 except device_errors.CommandFailedError: | 173 except (device_errors.CommandFailedError, |
| 174 device_errors.DeviceUnreachableError): |
| 174 logger.exception('Failed to provision device %s. Adding to blacklist.', | 175 logger.exception('Failed to provision device %s. Adding to blacklist.', |
| 175 str(device)) | 176 str(device)) |
| 176 if blacklist: | 177 if blacklist: |
| 177 blacklist.Extend([str(device)], reason='provision_failure') | 178 blacklist.Extend([str(device)], reason='provision_failure') |
| 178 | 179 |
| 179 | 180 |
| 180 def Wipe(device, adb_key_files=None): | 181 def Wipe(device, adb_key_files=None): |
| 181 if (device.IsUserBuild() or | 182 if (device.IsUserBuild() or |
| 182 device.build_version_sdk >= version_codes.MARSHMALLOW): | 183 device.build_version_sdk >= version_codes.MARSHMALLOW): |
| 183 WipeChromeData(device) | 184 WipeChromeData(device) |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 remove_system_webview=args.remove_system_webview, | 630 remove_system_webview=args.remove_system_webview, |
| 630 system_app_remove_list=args.system_app_remove_list, | 631 system_app_remove_list=args.system_app_remove_list, |
| 631 wipe=not args.skip_wipe and not args.emulators) | 632 wipe=not args.skip_wipe and not args.emulators) |
| 632 except (device_errors.DeviceUnreachableError, device_errors.NoDevicesError): | 633 except (device_errors.DeviceUnreachableError, device_errors.NoDevicesError): |
| 633 logging.exception('Unable to provision local devices.') | 634 logging.exception('Unable to provision local devices.') |
| 634 return exit_codes.INFRA | 635 return exit_codes.INFRA |
| 635 | 636 |
| 636 | 637 |
| 637 if __name__ == '__main__': | 638 if __name__ == '__main__': |
| 638 sys.exit(main(sys.argv[1:])) | 639 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |