Add per-IOM selection to firmware update workflow
Prompt user to choose IOM1 only, IOM2 only, or both before collecting IPs or running updates. Only prompts for IPs of selected IOMs, and suppresses the IOM1-first HA warning when updating a single IOM. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -588,10 +588,10 @@ def _get_fabric_fw_version(password: str, host: str, iom: str) -> str:
|
||||
return _c(C.RED, "Unreachable")
|
||||
|
||||
|
||||
def _show_fw_versions(password: str, iom1_ip: str, iom2_ip: str):
|
||||
def _show_fw_versions(password: str, ioms: list):
|
||||
info("Querying firmware versions...")
|
||||
rows = []
|
||||
for iom, ip in [("IOM1", iom1_ip), ("IOM2", iom2_ip)]:
|
||||
for iom, ip in ioms:
|
||||
iom_ver = _get_iom_fw_version(password, ip, iom)
|
||||
fabric_ver = _get_fabric_fw_version(password, ip, iom)
|
||||
rows.append([iom, ip, iom_ver, fabric_ver])
|
||||
@@ -696,13 +696,32 @@ def firmware_update_workflow():
|
||||
password = prompt_password()
|
||||
print()
|
||||
|
||||
info("Enter the management IP address for each IOM.")
|
||||
iom1_ip = prompt_ip(" IOM1 IP address")
|
||||
iom2_ip = prompt_ip(" IOM2 IP address")
|
||||
print(" Which IOM(s) would you like to update?")
|
||||
print(f" {_c(C.BOLD, '1')} IOM1 only")
|
||||
print(f" {_c(C.BOLD, '2')} IOM2 only")
|
||||
print(f" {_c(C.BOLD, '3')} Both IOM1 and IOM2")
|
||||
print()
|
||||
|
||||
while True:
|
||||
iom_choice = prompt("Select option [1-3]")
|
||||
if iom_choice in ("1", "2", "3"):
|
||||
break
|
||||
warn("Please enter 1, 2, or 3.")
|
||||
print()
|
||||
|
||||
info("Enter the management IP address for each IOM to update.")
|
||||
iom1_ip = prompt_ip(" IOM1 IP address") if iom_choice in ("1", "3") else ""
|
||||
iom2_ip = prompt_ip(" IOM2 IP address") if iom_choice in ("2", "3") else ""
|
||||
print()
|
||||
|
||||
ioms = []
|
||||
if iom_choice in ("1", "3"):
|
||||
ioms.append(("IOM1", iom1_ip))
|
||||
if iom_choice in ("2", "3"):
|
||||
ioms.append(("IOM2", iom2_ip))
|
||||
|
||||
rule("Current Firmware Versions")
|
||||
_show_fw_versions(password, iom1_ip, iom2_ip)
|
||||
_show_fw_versions(password, ioms)
|
||||
|
||||
print(" What would you like to update?")
|
||||
print(f" {_c(C.BOLD, '1')} IOM Firmware only")
|
||||
@@ -748,14 +767,15 @@ def firmware_update_workflow():
|
||||
|
||||
print()
|
||||
warn("For HA systems: update the passive IOM first.")
|
||||
warn("IOM1 will be updated first — adjust order if IOM2 is passive.")
|
||||
if len(ioms) > 1:
|
||||
warn("IOM1 will be updated first — adjust order if IOM2 is passive.")
|
||||
print()
|
||||
|
||||
if not prompt_yn("Proceed with firmware update?", default=True):
|
||||
info("Firmware update cancelled.")
|
||||
return
|
||||
|
||||
for iom, ip in [("IOM1", iom1_ip), ("IOM2", iom2_ip)]:
|
||||
for iom, ip in ioms:
|
||||
rule(f"{iom} ({ip})")
|
||||
if update_iom:
|
||||
_update_iom_fw(password, ip, iom, iom_fw_path)
|
||||
@@ -763,7 +783,7 @@ def firmware_update_workflow():
|
||||
_update_fabric_fw(password, ip, iom, fabric_fw_path)
|
||||
|
||||
rule("Post-Update Firmware Validation")
|
||||
_show_fw_versions(password, iom1_ip, iom2_ip)
|
||||
_show_fw_versions(password, ioms)
|
||||
|
||||
print()
|
||||
draw_box([
|
||||
|
||||
Reference in New Issue
Block a user