|
8 | 8 | from pandas import Series |
9 | 9 | from pandas import to_datetime |
10 | 10 | from py42 import exceptions |
| 11 | +from py42.clients.settings.device_settings import IncydrDeviceSettings |
11 | 12 | from py42.exceptions import Py42NotFoundError |
12 | 13 |
|
13 | 14 | from code42cli.bulk import generate_template_cmd_factory |
@@ -35,7 +36,9 @@ def devices(state): |
35 | 36 |
|
36 | 37 |
|
37 | 38 | device_guid_argument = click.argument( |
38 | | - "device-guid", type=str, callback=lambda ctx, param, arg: _verify_guid_type(arg), |
| 39 | + "device-guid", |
| 40 | + type=str, |
| 41 | + callback=lambda ctx, param, arg: _verify_guid_type(arg), |
39 | 42 | ) |
40 | 43 |
|
41 | 44 | new_device_name_option = click.option( |
@@ -159,8 +162,16 @@ def _update_cold_storage_purge_date(sdk, guid, purge_date): |
159 | 162 | def _change_device_name(sdk, guid, name): |
160 | 163 | try: |
161 | 164 | device_settings = sdk.devices.get_settings(guid) |
| 165 | + if isinstance(device_settings, IncydrDeviceSettings): |
| 166 | + raise Code42CLIError( |
| 167 | + "Failed to rename device. Incydr devices cannot be renamed." |
| 168 | + ) |
162 | 169 | device_settings.name = name |
163 | 170 | sdk.devices.update_settings(device_settings) |
| 171 | + except KeyError: |
| 172 | + raise Code42CLIError( |
| 173 | + "Failed to rename device. This device is missing expected settings fields." |
| 174 | + ) |
164 | 175 | except exceptions.Py42ForbiddenError: |
165 | 176 | raise Code42CLIError( |
166 | 177 | f"You don't have the necessary permissions to rename the device with GUID '{guid}'." |
@@ -500,7 +511,12 @@ def _break_backup_usage_into_total_storage(backup_usage): |
500 | 511 | @format_option |
501 | 512 | @sdk_options() |
502 | 513 | def list_backup_sets( |
503 | | - state, active, inactive, org_uid, include_usernames, format, |
| 514 | + state, |
| 515 | + active, |
| 516 | + inactive, |
| 517 | + org_uid, |
| 518 | + include_usernames, |
| 519 | + format, |
504 | 520 | ): |
505 | 521 | """Get information about many devices and their backup sets.""" |
506 | 522 | if inactive: |
|
0 commit comments