feat(services-restart): which services on the node still run replaced code, as root (NetOrk/netork#2750) #77

Open
christianmanivong wants to merge 4 commits from feature/services-need-restart into main
pull from: feature/services-need-restart
Owner

Both drivers (ProxmoxDriver, ProxmoxBackupDriver) mix in napalm-device-types' ServicesRestartMixin (NAPALM/napalm-device-types#132), so netOrk reads which services on a node still run code an update replaced on disk (NetOrk/netork#2750). A hypervisor is where restarting a service instead of the host matters most.

How. ProxmoxHostMixin._run_services_restart_command carries the mixin's one fixed, read-only command over the exec path (_exec_ssh_command), as _run_listening_sockets_command does; no stdin. The exec path is root's login as a rule, but a reading of another login's own processes would read as clean, so the command runs behind [ "$(id -u)" = 0 ] &&: another login prints nothing and the parse raises (no reading, not a clean one). On a node: needrestart in list-only mode where it is installed, else the /proc/<pid>/maps scan. A running VM's QEMU (qemu.slice/<vmid>.scope) is listed under processes; an LXC container's processes are left out by the parse (NAPALM/napalm-device-types#134), since a container updates itself.

Tests. tests/test_services_restart.py: both drivers declare the contract; the command goes over the exec path behind the root guard and parses a PVE node's output (pveproxy a unit, kvm a process, a container's nginx left out); PBS reads it the same way; as a non-root user the real guarded command prints nothing and the read raises. The whole suite: 702 passed locally; ruff and mypy clean.

Dependencies and version.

  • Needs napalm-device-types 4.46.0 (>=4.46.0): ServicesRestartMixin (#132, 4.45.0) with an LXC container's processes left out (#134, 4.46.0), and 0.14.0's CredentialExpiryMixin.
  • main (0.14.0, #76) is merged in, not rebased. The conflicts in CHANGELOG.md and pyproject.toml are resolved, and the whole suite passes on the merge: 744 passed locally against device-types #134's head.
  • The version is 0.16.0. main is 0.14.0, and #75 (feature/certificates-2656, #2656) takes 0.15.0. I re-checked the tags (v0.14.0 is the latest) before the merge.

CI is expected to be red until napalm-device-types 4.46.0 is released. pip cannot resolve the floor from the index; napalm-linux#86 is red for the same reason.

netOrk pins this branch in NetOrk/netork's feature/services-need-restart-drivers-2750.

Both drivers (`ProxmoxDriver`, `ProxmoxBackupDriver`) mix in napalm-device-types' `ServicesRestartMixin` (NAPALM/napalm-device-types#132), so netOrk reads which services on a node still run code an update replaced on disk (NetOrk/netork#2750). A hypervisor is where restarting a service instead of the host matters most. **How.** `ProxmoxHostMixin._run_services_restart_command` carries the mixin's one fixed, read-only command over the exec path (`_exec_ssh_command`), as `_run_listening_sockets_command` does; no stdin. The exec path is root's login as a rule, but a reading of another login's own processes would read as clean, so the command runs behind `[ "$(id -u)" = 0 ] &&`: another login prints nothing and the parse raises (no reading, not a clean one). On a node: `needrestart` in list-only mode where it is installed, else the `/proc/<pid>/maps` scan. A running VM's QEMU (`qemu.slice/<vmid>.scope`) is listed under `processes`; an LXC container's processes are left out by the parse (NAPALM/napalm-device-types#134), since a container updates itself. **Tests.** `tests/test_services_restart.py`: both drivers declare the contract; the command goes over the exec path behind the root guard and parses a PVE node's output (pveproxy a unit, kvm a process, a container's nginx left out); PBS reads it the same way; as a non-root user the real guarded command prints nothing and the read raises. The whole suite: 702 passed locally; ruff and mypy clean. **Dependencies and version.** - Needs napalm-device-types **4.46.0** (`>=4.46.0`): `ServicesRestartMixin` (#132, 4.45.0) with an LXC container's processes left out (#134, 4.46.0), and 0.14.0's `CredentialExpiryMixin`. - `main` (0.14.0, #76) is merged in, not rebased. The conflicts in `CHANGELOG.md` and `pyproject.toml` are resolved, and the whole suite passes on the merge: 744 passed locally against device-types #134's head. - The version is **0.16.0**. `main` is 0.14.0, and #75 (`feature/certificates-2656`, #2656) takes 0.15.0. I re-checked the tags (v0.14.0 is the latest) before the merge. **CI is expected to be red** until napalm-device-types 4.46.0 is released. pip cannot resolve the floor from the index; napalm-linux#86 is red for the same reason. netOrk pins this branch in NetOrk/netork's `feature/services-need-restart-drivers-2750`.
christianmanivong added 2 commits 2026-11-26 18:03:09 +00:00
Both drivers mix in napalm-device-types' ServicesRestartMixin. The command
goes over the exec path, root's login as a rule, behind an id -u guard: a
login other than root would see only its own processes and read as
clean, so it prints nothing and the read raises. A running VM's QEMU is
listed as a process; an LXC container's processes are left out by the
parse, since a container updates itself. No stdin.
chore(release): 0.16.0
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 18s
driver / types (pull_request) Failing after 58s
driver / test (3.12) (pull_request) Failing after 57s
driver / test (3.13) (pull_request) Failing after 52s
driver / lowest (pull_request) Failing after 27s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m12s
CI / driver (pull_request) Failing after 2m45s
driver / publish (pull_request) Skipped
63ffc64050
christianmanivong added 1 commit 2026-11-26 18:27:16 +00:00
Merge origin/main (0.14.0) into feature/services-need-restart
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Failing after 25s
driver / test (3.12) (pull_request) Failing after 17s
driver / test (3.13) (pull_request) Failing after 17s
driver / lowest (pull_request) Failing after 18s
driver / security (pull_request) Failing after 37s
driver / build (pull_request) Successful in 32s
CI / driver (pull_request) Failing after 1m32s
driver / publish (pull_request) Skipped
b37672a269
Needs napalm-device-types 4.46.0: ServicesRestartMixin with an LXC
container's processes left out, and 0.14.0's CredentialExpiryMixin.
christianmanivong added 1 commit 2026-11-26 18:52:54 +00:00
Merge remote-tracking branch 'origin/main' into feature/services-need-restart
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 14s
driver / test (3.12) (pull_request) Failing after 16s
driver / types (pull_request) Failing after 24s
driver / test (3.13) (pull_request) Failing after 14s
driver / lowest (pull_request) Failing after 14s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Failing after 37s
CI / driver (pull_request) Failing after 1m35s
driver / publish (pull_request) Skipped
f9088bae3a
# Conflicts:
#	CHANGELOG.md
#	README.md
#	pyproject.toml
Some required checks failed
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 14s
driver / test (3.12) (pull_request) Failing after 16s
driver / types (pull_request) Failing after 24s
driver / test (3.13) (pull_request) Failing after 14s
driver / lowest (pull_request) Failing after 14s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Failing after 37s
CI / driver (pull_request) Failing after 1m35s
driver / publish (pull_request) Skipped
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/services-need-restart:feature/services-need-restart
git checkout feature/services-need-restart
Sign in to join this conversation.