feat: say whether a host is still in its first boot
CI / test (3.10) (push) Successful in 29s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 29s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.11) (pull_request) Successful in 46s
CI / test (3.12) (pull_request) Successful in 42s

first_boot_pending() is true while /firstboot exists on FreeBSD. A FreeBSD
cloud image upgrades its base system on its first boot, starts sshd only
after that and restarts right away, and /etc/rc removes /firstboot just
before that restart. netOrk waits for this before it sets up a new VM
(NetOrk/netork#795).

OpenBSD has no such marker to ask yet, so it returns False there.
This commit is contained in:
Christian Manivong
2026-10-08 12:58:00 +02:00
parent ae09e44345
commit 32a63411d3
5 changed files with 49 additions and 0 deletions
+23
View File
@@ -610,3 +610,26 @@ class TestAFailedReadRaises:
driver = _channel(OpenBSDDriver, answers)
with pytest.raises(RuntimeError, match=failing.split()[0]):
driver.get_available_updates()
class TestFirstBoot:
"""Whether the host is still in its first boot (NetOrk/netork#795).
A FreeBSD cloud image upgrades its base system on the first boot, starts
sshd only then and restarts right after; /etc/rc removes /firstboot just
before that restart. netOrk waits for it before setting up a new VM.
"""
def test_freebsd_in_its_first_boot(self):
driver = _channel(FreeBSDDriver, {"test -e /firstboot": ("", 0)})
assert driver.first_boot_pending() is True
assert driver.calls == [("test -e /firstboot", False)]
def test_freebsd_after_its_first_boot(self):
driver = _channel(FreeBSDDriver, {"test -e /firstboot": ("", 1)})
assert driver.first_boot_pending() is False
def test_openbsd_has_no_marker_to_ask(self):
driver = _channel(OpenBSDDriver, {})
assert driver.first_boot_pending() is False
assert driver.calls == []