|
12 | 12 |
|
13 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) |
14 | 14 | @click.argument('identifier') |
| 15 | +@click.option('-i', '--ipmi', is_flag=True, help="Update IPMI firmware") |
| 16 | +@click.option('-r', '--raid', is_flag=True, help="Update RAID firmware") |
| 17 | +@click.option('-b', '--bios', is_flag=True, help="Update BIOS firmware") |
| 18 | +@click.option('-d', '--harddrive', is_flag=True, help="Update Hard Drives firmware") |
| 19 | +@click.option('-n', '--network', is_flag=True, help="Update Network Card firmware") |
15 | 20 | @environment.pass_env |
16 | | -def cli(env, identifier): |
17 | | - """Update server firmware.""" |
| 21 | +def cli(env, identifier, ipmi, raid, bios, harddrive, network): |
| 22 | + """Update server firmware. By default will update all available server components.""" |
18 | 23 |
|
19 | 24 | mgr = SoftLayer.HardwareManager(env.client) |
20 | 25 | hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') |
21 | | - if not (env.skip_confirmations or |
22 | | - formatting.confirm('This will power off the server with id %s and ' |
23 | | - 'update device firmware. Continue?' % hw_id)): |
| 26 | + confirm_message = f"This will power off the server with id {hw_id} and update device firmware. Continue?" |
| 27 | + if not (env.skip_confirmations or formatting.confirm(confirm_message)): |
24 | 28 | raise exceptions.CLIAbort('Aborted.') |
25 | 29 |
|
26 | | - mgr.update_firmware(hw_id) |
| 30 | + # If no options were specified, set them all to enabled. |
| 31 | + if not any([ipmi, raid, bios, harddrive, network]): |
| 32 | + ipmi = raid = bios = harddrive = network = 1 |
| 33 | + mgr.update_firmware(hw_id, ipmi, raid, bios, harddrive, network) |
| 34 | + env.fout(f"[green]Firmware update for {identifier} started") |
0 commit comments