Add firmware/ directory and update file scanning logic
- Add firmware/ directory to hold firmware files for techs cloning the repo - Scan firmware/ (relative to script location) instead of CWD - Add .fwc to supported firmware extensions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ No external dependencies — Python 3 standard library only. Compatible with Tru
|
|||||||
|
|
||||||
```
|
```
|
||||||
es24n_conf.py ← Entry point and main menu (run this)
|
es24n_conf.py ← Entry point and main menu (run this)
|
||||||
|
firmware/ ← Firmware files (.bin, .img, .fw, etc.) — scanned at update time
|
||||||
modules/
|
modules/
|
||||||
ui.py ← ANSI colours, display helpers, input prompts
|
ui.py ← ANSI colours, display helpers, input prompts
|
||||||
serial_port.py ← SerialPort class (termios/fcntl/select, no pyserial)
|
serial_port.py ← SerialPort class (termios/fcntl/select, no pyserial)
|
||||||
@@ -53,7 +54,7 @@ Updates IOM firmware and/or Fabric Card firmware over the network:
|
|||||||
- Polls `/redfish/v1/TaskService/Tasks/` until completion
|
- Polls `/redfish/v1/TaskService/Tasks/` until completion
|
||||||
- Restarts the IOM (and fabric card if applicable) after each update
|
- Restarts the IOM (and fabric card if applicable) after each update
|
||||||
- The firmware file must be re-uploaded between the IOM and Fabric Card steps — it does not persist after the first update (firmware quirk, documented in `_update_fabric_fw()`)
|
- The firmware file must be re-uploaded between the IOM and Fabric Card steps — it does not persist after the first update (firmware quirk, documented in `_update_fabric_fw()`)
|
||||||
- Scans the current working directory for firmware files (`.bin`, `.img`, `.fw`, `.hex`, `.zip`, `.tar`, `.tgz`, `.gz`) and presents them as a numbered list before falling back to manual path entry
|
- Scans the `firmware/` directory (next to `es24n_conf.py`) for firmware files (`.bin`, `.img`, `.fw`, `.fwc`, `.hex`, `.zip`, `.tar`, `.tgz`, `.gz`) and presents them as a numbered list before falling back to manual path entry
|
||||||
|
|
||||||
### 3 — System Check (`workflow_check.py`)
|
### 3 — System Check (`workflow_check.py`)
|
||||||
Read-only diagnostic workflow — queries current network settings and firmware versions, makes no changes:
|
Read-only diagnostic workflow — queries current network settings and firmware versions, makes no changes:
|
||||||
|
|||||||
BIN
firmware/ves-vds2249r-rflex-MGR-04.12.33-A2000Tfw_2.4.1.fwc
Normal file
BIN
firmware/ves-vds2249r-rflex-MGR-04.12.33-A2000Tfw_2.4.1.fwc
Normal file
Binary file not shown.
@@ -25,20 +25,22 @@ from ui import (
|
|||||||
# ── Firmware file selection helper ────────────────────────────────────────────
|
# ── Firmware file selection helper ────────────────────────────────────────────
|
||||||
def _prompt_fw_file(label: str) -> str:
|
def _prompt_fw_file(label: str) -> str:
|
||||||
"""
|
"""
|
||||||
Scan the current working directory for firmware files and let the user
|
Scan the firmware/ directory (next to es24n_conf.py) for firmware files
|
||||||
pick one by number, or enter a custom path as the last option.
|
and let the user pick one by number, or enter a custom path as the last
|
||||||
Files are sorted most-recently-modified first.
|
option. Files are sorted most-recently-modified first.
|
||||||
"""
|
"""
|
||||||
cwd = os.getcwd()
|
fw_dir = os.path.normpath(
|
||||||
FW_EXTS = {".bin", ".img", ".fw", ".hex", ".zip", ".tar", ".tgz", ".gz"}
|
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "firmware")
|
||||||
|
)
|
||||||
|
FW_EXTS = {".bin", ".img", ".fw", ".fwc", ".hex", ".zip", ".tar", ".tgz", ".gz"}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
candidates = sorted(
|
candidates = sorted(
|
||||||
[f for f in os.listdir(cwd)
|
[f for f in os.listdir(fw_dir)
|
||||||
if not f.startswith(".")
|
if not f.startswith(".")
|
||||||
and os.path.isfile(os.path.join(cwd, f))
|
and os.path.isfile(os.path.join(fw_dir, f))
|
||||||
and os.path.splitext(f)[1].lower() in FW_EXTS],
|
and os.path.splitext(f)[1].lower() in FW_EXTS],
|
||||||
key=lambda f: os.path.getmtime(os.path.join(cwd, f)),
|
key=lambda f: os.path.getmtime(os.path.join(fw_dir, f)),
|
||||||
reverse=True,
|
reverse=True,
|
||||||
)
|
)
|
||||||
except OSError:
|
except OSError:
|
||||||
@@ -46,9 +48,9 @@ def _prompt_fw_file(label: str) -> str:
|
|||||||
|
|
||||||
print()
|
print()
|
||||||
if candidates:
|
if candidates:
|
||||||
info(f"Firmware files found in {cwd}:")
|
info(f"Firmware files found in {fw_dir}:")
|
||||||
for i, fname in enumerate(candidates, 1):
|
for i, fname in enumerate(candidates, 1):
|
||||||
sz = os.path.getsize(os.path.join(cwd, fname))
|
sz = os.path.getsize(os.path.join(fw_dir, fname))
|
||||||
print(f" {_c(C.BOLD, str(i))} {fname} {_c(C.DIM, f'({sz // 1024} KB)')}")
|
print(f" {_c(C.BOLD, str(i))} {fname} {_c(C.DIM, f'({sz // 1024} KB)')}")
|
||||||
custom_idx = len(candidates) + 1
|
custom_idx = len(candidates) + 1
|
||||||
print(f" {_c(C.BOLD, str(custom_idx))} Enter a custom file path")
|
print(f" {_c(C.BOLD, str(custom_idx))} Enter a custom file path")
|
||||||
@@ -59,7 +61,7 @@ def _prompt_fw_file(label: str) -> str:
|
|||||||
if choice.isdigit():
|
if choice.isdigit():
|
||||||
idx = int(choice)
|
idx = int(choice)
|
||||||
if 1 <= idx <= len(candidates):
|
if 1 <= idx <= len(candidates):
|
||||||
path = os.path.join(cwd, candidates[idx - 1])
|
path = os.path.join(fw_dir, candidates[idx - 1])
|
||||||
sz = os.path.getsize(path)
|
sz = os.path.getsize(path)
|
||||||
ok(f"Selected: {candidates[idx - 1]} ({sz // 1024} KB)")
|
ok(f"Selected: {candidates[idx - 1]} ({sz // 1024} KB)")
|
||||||
return path
|
return path
|
||||||
@@ -67,7 +69,7 @@ def _prompt_fw_file(label: str) -> str:
|
|||||||
break
|
break
|
||||||
warn(f"Please enter a number between 1 and {custom_idx}.")
|
warn(f"Please enter a number between 1 and {custom_idx}.")
|
||||||
else:
|
else:
|
||||||
info(f"No firmware files found in {cwd}.")
|
info(f"No firmware files found in {fw_dir}.")
|
||||||
|
|
||||||
# Manual path entry
|
# Manual path entry
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user