Files
es24n-conf/es24n_conf.py
scott c87e1457d4 Fix 'configure another shelf' looping back to main menu
When configure_shelf() returned True the outer while loop re-displayed
the main menu instead of starting the next shelf cycle immediately.
Now loops directly back into configure_shelf() until the user declines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 11:41:24 -04:00

68 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python3
"""
ES24N IOM Network Configuration Tool
TrueNAS ES24N Expansion Shelf — Serial Configuration Utility
Based on ES24N Product Service Guide v.26011
Zero external dependencies — Python 3 standard library only.
Compatible with TrueNAS (FreeBSD) and Linux.
Usage:
python3 es24n_conf.py
All files in the modules/ subdirectory must be present:
ui.py, serial_port.py, models.py, redfish.py,
workflow_serial.py, workflow_firmware.py, workflow_check.py
"""
import os
import sys
import time
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "modules"))
from ui import _c, C, banner, draw_box, ok, warn, prompt
from workflow_check import system_check_workflow
from workflow_firmware import firmware_update_workflow
from workflow_serial import configure_shelf
def main():
while True:
banner()
draw_box([
f" {_c(C.BOLD, '1')} Configure Network Settings",
f" {_c(C.BOLD, '2')} Update IOM / Fabric Card Firmware",
f" {_c(C.BOLD, '3')} Query Current Configuration",
f" {_c(C.BOLD, '4')} Exit",
])
print()
choice = prompt("Select [1/2/3/4]")
if choice == "1":
another = True
while another:
another = configure_shelf()
elif choice == "2":
firmware_update_workflow()
elif choice == "3":
system_check_workflow()
elif choice == "4":
break
else:
warn("Please enter 1, 2, 3, or 4.")
time.sleep(1)
print()
ok("Exiting ES24N IOM Configuration Tool. Goodbye.")
print()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print()
warn("Interrupted. Exiting.")
sys.exit(0)