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
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:
@@ -188,6 +188,21 @@ class BsdDriver(HostStatusMixin, OSDriver):
|
||||
and the readers below treat empty output as "nothing there"."""
|
||||
return self.run_command(command, privileged=privileged, timeout=timeout).stdout.strip()
|
||||
|
||||
#: A file that exists until the host's first boot is over; "" when there is none to ask.
|
||||
FIRST_BOOT_MARKER = ""
|
||||
|
||||
def first_boot_pending(self) -> bool:
|
||||
"""Whether the host is still in its first boot.
|
||||
|
||||
A FreeBSD cloud image upgrades its base system on the first boot, starts
|
||||
sshd only after that and restarts right away; ``/etc/rc`` removes
|
||||
``/firstboot`` just before the restart. netOrk waits for this before it
|
||||
sets up a new VM (NetOrk/netork#795).
|
||||
"""
|
||||
if not self.FIRST_BOOT_MARKER:
|
||||
return False
|
||||
return self.run_command(f"test -e {self.FIRST_BOOT_MARKER}").exit_code == 0
|
||||
|
||||
def _run_host_status_command(self, command: str) -> str:
|
||||
"""The transport for ``HostStatusMixin.get_host_status``: read-only, no root.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user