|
11 | 11 |
|
12 | 12 | @click.command() |
13 | 13 | @click.argument('identifier', type=int) |
14 | | -@click.option('--hardware', |
15 | | - 'hardware_identifier', |
| 14 | +@click.option('--hardware', 'hardware_identifier', |
16 | 15 | help="The identifier for hardware to detach") |
17 | | -@click.option('--virtual', |
18 | | - 'virtual_identifier', |
| 16 | +@click.option('--virtual', 'virtual_identifier', |
19 | 17 | help="The identifier for a virtual server to detach") |
20 | 18 | @environment.pass_env |
21 | 19 | def cli(env, identifier, hardware_identifier, virtual_identifier): |
22 | 20 | """Detach devices from a ticket.""" |
23 | 21 | ticket_mgr = SoftLayer.TicketManager(env.client) |
24 | 22 |
|
25 | 23 | if hardware_identifier and virtual_identifier: |
26 | | - raise exceptions.ArgumentError( |
27 | | - "Cannot detach hardware and a virtual server at the same time") |
28 | | - elif hardware_identifier: |
| 24 | + raise exceptions.ArgumentError("Cannot detach hardware and a virtual server at the same time") |
| 25 | + |
| 26 | + if hardware_identifier: |
29 | 27 | hardware_mgr = SoftLayer.HardwareManager(env.client) |
30 | | - hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids, |
31 | | - hardware_identifier, |
32 | | - 'hardware') |
| 28 | + hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids, hardware_identifier, 'hardware') |
33 | 29 | ticket_mgr.detach_hardware(identifier, hardware_id) |
34 | 30 | elif virtual_identifier: |
35 | 31 | vs_mgr = SoftLayer.VSManager(env.client) |
36 | | - vs_id = helpers.resolve_id(vs_mgr.resolve_ids, |
37 | | - virtual_identifier, |
38 | | - 'VS') |
| 32 | + vs_id = helpers.resolve_id(vs_mgr.resolve_ids, virtual_identifier, 'VS') |
39 | 33 | ticket_mgr.detach_virtual_server(identifier, vs_id) |
40 | 34 | else: |
41 | | - raise exceptions.ArgumentError( |
42 | | - "Must have a hardware or virtual server identifier to detach") |
| 35 | + raise exceptions.ArgumentError("Must have a hardware or virtual server identifier to detach") |
0 commit comments