|
22 | 22 | help="Public port speed. -1 is best speed available") |
23 | 23 | @click.option('--private-speed', default=None, type=click.Choice(['0', '10', '100', '1000', '10000', '-1']), |
24 | 24 | help="Private port speed. -1 is best speed available") |
| 25 | +@click.option('--redundant', is_flag=True, default=False, help="The desired state of redundancy for the interface(s)") |
| 26 | +@click.option('--degraded', is_flag=True, default=False, help="The desired state of degraded for the interface(s)") |
25 | 27 | @environment.pass_env |
26 | | -def cli(env, identifier, domain, userfile, tag, hostname, userdata, public_speed, private_speed): |
| 28 | +def cli(env, identifier, domain, userfile, tag, hostname, userdata, public_speed, private_speed, redundant, degraded): |
27 | 29 | """Edit hardware details.""" |
28 | 30 |
|
29 | 31 | if userdata and userfile: |
@@ -51,7 +53,17 @@ def cli(env, identifier, domain, userfile, tag, hostname, userdata, public_speed |
51 | 53 | raise exceptions.CLIAbort("Failed to update hardware") |
52 | 54 |
|
53 | 55 | if public_speed is not None: |
54 | | - mgr.change_port_speed(hw_id, True, int(public_speed)) |
| 56 | + if redundant: |
| 57 | + mgr.change_port_speed(hw_id, True, int(public_speed), 'redundant') |
| 58 | + if degraded: |
| 59 | + mgr.change_port_speed(hw_id, True, int(public_speed), 'degraded') |
| 60 | + if not redundant and not degraded: |
| 61 | + raise exceptions.CLIAbort("Failed to update hardwar") |
55 | 62 |
|
56 | 63 | if private_speed is not None: |
57 | | - mgr.change_port_speed(hw_id, False, int(private_speed)) |
| 64 | + if redundant: |
| 65 | + mgr.change_port_speed(hw_id, False, int(private_speed), 'redundant') |
| 66 | + if degraded: |
| 67 | + mgr.change_port_speed(hw_id, False, int(private_speed), 'degraded') |
| 68 | + if not redundant and not degraded: |
| 69 | + raise exceptions.CLIAbort("Failed to update hardware") |
0 commit comments