From 998fb034a268b260c98ca2c67ac502fe8cc213df Mon Sep 17 00:00:00 2001 From: scott Date: Thu, 16 Apr 2026 12:24:17 -0400 Subject: [PATCH] Prompt for IOM1 or IOM2 in serial system check workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the same change made to option 1 — asks which IOM the serial cable is connected to after login, then uses that selection in all Redfish paths for network settings, IOM firmware, and Fabric Card firmware. Co-Authored-By: Claude Sonnet 4.6 --- CLAUDE.md | 2 +- modules/workflow_check.py | 36 ++++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5dc8f5a..3a66fe0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -58,7 +58,7 @@ Updates IOM firmware and/or Fabric Card firmware over the network: ### 3 — System Check (`workflow_check.py`) Read-only diagnostic workflow — queries current network settings and firmware versions, makes no changes: -- **Serial:** logs in via serial console, queries IOM1 only using `_serial_redfish_request()` (curl over the serial session); covers network settings, IOM firmware, and Fabric Card firmware. IOM2 is not reachable over serial. +- **Serial:** prompts for IOM1 or IOM2, logs in via serial console, queries the selected IOM using `_serial_redfish_request()` (curl over the serial session); covers network settings, IOM firmware, and Fabric Card firmware. - **Network:** prompts for management IP(s), queries via direct HTTPS using `Admin` credentials; reuses `_redfish_request()`, `_get_iom_fw_version()`, `_get_fabric_fw_version()` from `redfish.py` - Displays results in two tables: network configuration and firmware versions - User selects Serial, Network, or Cancel at the sub-menu prompt diff --git a/modules/workflow_check.py b/modules/workflow_check.py index f7133ea..31c21ce 100644 --- a/modules/workflow_check.py +++ b/modules/workflow_check.py @@ -113,30 +113,42 @@ def _check_via_serial(): time.sleep(2) return - rule("Querying IOM1 Status") - info("Querying IOM1 network settings and firmware versions via serial console...") - info("Note: only IOM1 is reachable over the serial connection.") + # Prompt for which IOM the serial cable is connected to + print() + print(" Which IOM is the serial cable connected to?") + print(f" {_c(C.BOLD, '1')} IOM1") + print(f" {_c(C.BOLD, '2')} IOM2") + print() + while True: + iom_choice = prompt("Select [1/2]") + if iom_choice in ("1", "2"): + break + warn("Please enter 1 or 2.") + iom = "IOM1" if iom_choice == "1" else "IOM2" + + rule(f"Querying {iom} Status") + info(f"Querying {iom} network settings and firmware versions via serial console...") print() # ── Network settings ─────────────────────────────────────────────────────── net_ok, net_data = _serial_redfish_request( ser, password, "GET", - "/redfish/v1/Managers/IOM1/EthernetInterfaces/1", + f"/redfish/v1/Managers/{iom}/EthernetInterfaces/1", ) if net_ok and isinstance(net_data, dict): dhcp, ip, gw, nm, mac, hostname, link = _parse_network_data(net_data) mode = _c(C.CYN, "DHCP") if dhcp else _c(C.GRN, "Static") - net_rows = [["IOM1", mode, ip, gw, nm, link]] - iface_rows = [["IOM1", mac, hostname]] + net_rows = [[iom, mode, ip, gw, nm, link]] + iface_rows = [[iom, mac, hostname]] else: - net_rows = [["IOM1", _c(C.RED, "No response"), "--", "--", "--", "--"]] - iface_rows = [["IOM1", "--", "--"]] - error(f"IOM1 network query failed: {net_data}") + net_rows = [[iom, _c(C.RED, "No response"), "--", "--", "--", "--"]] + iface_rows = [[iom, "--", "--"]] + error(f"{iom} network query failed: {net_data}") # ── IOM firmware version ─────────────────────────────────────────────────── iom_ok, iom_data = _serial_redfish_request( ser, password, "GET", - "/redfish/v1/Managers/IOM1", + f"/redfish/v1/Managers/{iom}", ) iom_ver = ( iom_data.get("FirmwareVersion", "Unknown") @@ -147,7 +159,7 @@ def _check_via_serial(): # ── Fabric card firmware version ─────────────────────────────────────────── fab_ok, fab_data = _serial_redfish_request( ser, password, "GET", - "/redfish/v1/Chassis/IOM1/NetworkAdapters/1", + f"/redfish/v1/Chassis/{iom}/NetworkAdapters/1", ) fab_ver = ( (fab_data.get("Oem", {}) @@ -158,7 +170,7 @@ def _check_via_serial(): else _c(C.RED, "Unreachable") ) - _print_results(net_rows, iface_rows, [["IOM1", iom_ver, fab_ver]]) + _print_results(net_rows, iface_rows, [[iom, iom_ver, fab_ver]]) close_serial_connection(ser, device)