| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 logging.info("Version name for %s is %s", package, version_name) | 130 logging.info("Version name for %s is %s", package, version_name) |
| 131 | 131 |
| 132 CheckExternalStorage(device) | 132 CheckExternalStorage(device) |
| 133 | 133 |
| 134 except device_errors.CommandTimeoutError: | 134 except device_errors.CommandTimeoutError: |
| 135 logging.exception('Timed out waiting for device %s. Adding to blacklist.', | 135 logging.exception('Timed out waiting for device %s. Adding to blacklist.', |
| 136 str(device)) | 136 str(device)) |
| 137 if blacklist: | 137 if blacklist: |
| 138 blacklist.Extend([str(device)], reason='provision_timeout') | 138 blacklist.Extend([str(device)], reason='provision_timeout') |
| 139 | 139 |
| 140 except device_errors.CommandFailedError: | 140 except (device_errors.CommandFailedError, |
| 141 device_errors.DeviceUnreachableError): |
| 141 logging.exception('Failed to provision device %s. Adding to blacklist.', | 142 logging.exception('Failed to provision device %s. Adding to blacklist.', |
| 142 str(device)) | 143 str(device)) |
| 143 if blacklist: | 144 if blacklist: |
| 144 blacklist.Extend([str(device)], reason='provision_failure') | 145 blacklist.Extend([str(device)], reason='provision_failure') |
| 145 | 146 |
| 146 def CheckExternalStorage(device): | 147 def CheckExternalStorage(device): |
| 147 """Checks that storage is writable and if not makes it writable. | 148 """Checks that storage is writable and if not makes it writable. |
| 148 | 149 |
| 149 Arguments: | 150 Arguments: |
| 150 device: The device to check. | 151 device: The device to check. |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 552 |
| 552 try: | 553 try: |
| 553 return ProvisionDevices(args) | 554 return ProvisionDevices(args) |
| 554 except (device_errors.DeviceUnreachableError, device_errors.NoDevicesError): | 555 except (device_errors.DeviceUnreachableError, device_errors.NoDevicesError): |
| 555 logging.exception('Unable to provision local devices.') | 556 logging.exception('Unable to provision local devices.') |
| 556 return exit_codes.INFRA | 557 return exit_codes.INFRA |
| 557 | 558 |
| 558 | 559 |
| 559 if __name__ == '__main__': | 560 if __name__ == '__main__': |
| 560 sys.exit(main()) | 561 sys.exit(main()) |
| OLD | NEW |