From fe0836353480dca9df106de4205a280b1a6fb6f0 Mon Sep 17 00:00:00 2001 From: ekklesia Date: Mon, 21 Sep 2026 21:23:30 -0500 Subject: [PATCH] fix: a machine with no ifupdown configuration is not an error The release validator caught it: in a container there is no /etc/network/interfaces at all, and a missing file was being treated as a read failure, so --check printed nothing and said nothing was wrong rather than saying there was nothing to do. A machine with no ifupdown configuration is the ordinary case for a fresh install, and the answer is simply that this command has no work. Co-Authored-By: Claude Opus 5 --- VERSION | 2 +- scripts/classroom-wifi | 5 +++++ tests/test-classroom-network-adopt.sh | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index abd4105..3a4036f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.4 +0.2.5 diff --git a/scripts/classroom-wifi b/scripts/classroom-wifi index 181bcd4..8da11d8 100755 --- a/scripts/classroom-wifi +++ b/scripts/classroom-wifi @@ -208,6 +208,11 @@ def carrying(name, device): def find_stanza(): """The one wireless stanza ifupdown holds, or None, plus the file.""" + if not os.path.exists(INTERFACES): + # A machine with no ifupdown configuration at all. Nothing is + # wrong with that and nothing here has anything to do. + return None, "" + try: with open(INTERFACES, "r", encoding="utf-8") as handle: text = handle.read() diff --git a/tests/test-classroom-network-adopt.sh b/tests/test-classroom-network-adopt.sh index 02f0755..33d3200 100755 --- a/tests/test-classroom-network-adopt.sh +++ b/tests/test-classroom-network-adopt.sh @@ -166,7 +166,15 @@ check("it refuses to start when it could not undo itself", "shutil.which" in wifi and "leaving the network exactly as it is" in wifi) -print("9. the upgrade does not do any of this on its own") +print("9. a machine with no ifupdown configuration at all") +# A container, and any machine installed without ifupdown. Found by the +# release validator: --check said nothing at all, because a missing file +# was being treated as a read error. +check("a missing interfaces file is not an error, it is just nothing to do", + "not os.path.exists(INTERFACES)" in wifi + and 'return None, ""' in wifi) + +print("10. the upgrade does not do any of this on its own") # Moving a machine's only link during an unattended upgrade is fine until # the once it is not, and the machine it would strand is a laptop in a # locked room.