From 6ecab1cbe27ec4849d8fdc7ac6ee3115a824ba83 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Thu, 26 Nov 2026 18:56:05 +0100 Subject: [PATCH] docs: no services restart reading on the BSDs, and a test that keeps it so (NetOrk/netork#2750) napalm-device-types' ServicesRestartMixin reads needrestart or /proc//maps and names systemd units by cgroup; a BSD has none of them. Without the method the caller shows the reading as not made, not as clean. A FreeBSD reading of its own is #33. --- README.md | 7 +++++++ tests/test_drivers.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index f069252..c3d1fac 100644 --- a/README.md +++ b/README.md @@ -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//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 diff --git a/tests/test_drivers.py b/tests/test_drivers.py index 8235398..ad908bf 100644 --- a/tests/test_drivers.py +++ b/tests/test_drivers.py @@ -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")