fix: report which services are enabled, and whether an action worked

get_services() read list-unit-files' second column, which since systemd 245
is followed by a preset column -- "enabled  enabled" never equalled
"enabled", so every service on every node was reported disabled (#6).
manage_service() ended in "|| true" and returned success whatever happened.

Both now come from napalm-device-types' SystemdServicesMixin (2.2.0): the
enabled state is UnitFileState from systemctl show, MainPID comes along in
the same round trip, and an action reports systemctl's exit status. The
driver keeps only _run_service_command(), its exec path as root. The exit
status marker keeps the output non-empty, so _exec_ssh_command's SSH fallback
on an empty API answer can no longer run an action twice.

The listing no longer includes templates, static unit files and aliases that
are not loaded (on a PVE 9 node: 280 entries -> 172).

Closes #6
This commit is contained in:
Christian Manivong
2026-10-05 13:12:14 +02:00
parent ea74e84387
commit 6bf1736619
4 changed files with 83 additions and 71 deletions
+8 -1
View File
@@ -34,7 +34,13 @@ from typing import Any
logger = logging.getLogger(__name__)
from napalm_device_types import FingerprintRule, HypervisorDriver, KernelFactsMixin, PortSpec
from napalm_device_types import (
FingerprintRule,
HypervisorDriver,
KernelFactsMixin,
PortSpec,
SystemdServicesMixin,
)
from napalm.base.exceptions import ConnectionException
try:
@@ -77,6 +83,7 @@ class ProxmoxDriver(
ProxmoxRoutingMixin,
ProxmoxSystemMixin,
KernelFactsMixin,
SystemdServicesMixin,
HypervisorDriver,
):
"""NAPALM driver for Proxmox VE nodes."""