docs: no services restart reading on the BSDs, and a test that keeps it so (NetOrk/netork#2750) #34

Merged
christianmanivong merged 1 commits from docs/no-services-restart into main 2026-11-26 18:56:45 +00:00
2 changed files with 18 additions and 0 deletions
Showing only changes of commit 6ecab1cbe2 - Show all commits

No files matched your search

+7
View File
@@ -55,6 +55,13 @@ There is deliberately no `get_kernel_facts`: `KernelFactsMixin` reports a
Linux kernel's modules and `CONFIG_*` options, which a BSD kernel does not
have, and `hasattr(driver, "get_kernel_facts")` has to stay truthful.
Nor is there a `get_services_need_restart` (napalm-device-types'
`ServicesRestartMixin`, NetOrk/netork#2750): it reads `needrestart` or each
process's `/proc/<pid>/maps` and names systemd units by cgroup, none of which a
BSD has. Mixed in, it would read nothing, or read clean; without it the caller
knows the reading was not made. A FreeBSD reading of its own (`procstat -v`, the
rc.d service behind each PID) is #33.
**Updates.** `security` on FreeBSD comes from VuXML (`pkg audit`): True for a
package it lists as vulnerable, False for one it does not, None when the audit
could not run. OpenBSD's tools do not say, so it is None there. Base-system
+11
View File
@@ -791,3 +791,14 @@ class TestSshServerAuth:
driver = _channel(FreeBSDDriver, {(SSHD_EFFECTIVE_COMMAND, True): ("", 1)})
with pytest.raises(RuntimeError, match="sshd -T"):
driver.get_ssh_server_auth()
class TestNoServicesRestartReading:
"""napalm-device-types' ``ServicesRestartMixin`` reads Linux's ``/proc`` and systemd's
cgroups (NetOrk/netork#2750). A BSD host has neither, so the drivers do not offer it,
and the caller shows the reading as not made rather than as clean."""
@pytest.mark.parametrize("cls", [FreeBSDDriver, OpenBSDDriver])
def test_it_is_not_offered(self, cls):
assert not hasattr(cls, "get_services_need_restart")
assert not hasattr(cls, "_run_services_restart_command")