Fail earlier if the ota update file isn't found

This commit is contained in:
Ian McEwen committed 2026-06-25 14:28:32 -07:00
1 parent f0de977be5
commit 7fc69e957c
2 files changed
+8

No files matched your search

+5
View File
@@ -1383,6 +1383,11 @@ def common():
if not stripped_ham_name:
meshtastic.util.our_exit("ERROR: Ham radio callsign cannot be empty or contain only whitespace characters")
# Early validation for OTA firmware file before attempting device connection
if hasattr(args, 'ota_update') and args.ota_update is not None:
if not os.path.isfile(args.ota_update):
meshtastic.util.our_exit(f"Error: OTA firmware file not found: {args.ota_update}", 1)
if have_powermon:
create_power_meter()
+3
View File
@@ -3157,6 +3157,9 @@ def test_main_ota_update_file_not_found(capsys):
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
out, err = capsys.readouterr()
assert "OTA firmware file not found" in out
assert "/nonexistent/firmware.bin" in out
@pytest.mark.unit