fix: drop install anyway when nothing can come

Offline with nothing here to copy, Install was removed, and a folder
short of space or read-only then put Install anyway back: a run that
could only fail every file.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 22:14:17 +02:00
1 parent bc4bcadcd3
commit c67dd2ad46
2 files changed
+14 -3

No files matched your search

+3 -3
View File
@@ -10428,13 +10428,13 @@ def _plan_rows(state: TuiState) -> list[TuiRow]:
rows = [TuiRow("install", label)]
if _offline_only() and not _plan_copies(state, check):
# Nothing here to copy, and the network refused: Install would
# only fail every file.
# only fail every file, in this folder or another.
rows = []
if state.facts.get("writable") is False or _short_of_space(state, check):
# Every file would fail alike, or the run would stop before the
# first one: the way out is another folder.
rows = [TuiRow("folder", "Choose another folder"), TuiRow("install", "Install anyway"),
*rows[1:]]
rows = [TuiRow("folder", "Choose another folder"),
*([TuiRow("install", "Install anyway")] if rows else [])]
if records_selection((state.manifest or {}).get("files", [])) and len(state.systems) > 1:
rows.append(TuiRow("systems", "Choose systems"))
rows.append(TuiRow("fromcard", "Copy the BIOS files from your old card or a folder"))
+11
View File
@@ -2212,6 +2212,17 @@ class AuditRoundThree(unittest.TestCase):
self.assertEqual(press(state, "enter"), [])
self.assertEqual(state.screen, "folder")
def test_offline_with_nothing_to_copy_offers_no_install_anyway(self):
"""Offline with nothing here to copy, Install is removed: a folder
short of space then put "Install anyway" back, a run that could
only fail every file."""
state = checked_state({"free": 1024, "writable": False, "cores": []})
with mock.patch.dict(os.environ, {install.OFFLINE_VARIABLE: "1"}):
labels = [row.label for row in install.tui_rows(state)]
self.assertEqual(labels[0], "Choose another folder")
self.assertNotIn("Install anyway", labels)
self.assertFalse(any(label.startswith("Install") for label in labels), labels)
FULL_TAIL = [
" Checking existing files...",
" 0/50 present (0 verified, 0 wrong hash)",