From 77313ca436f3ea41c2df1d1b6ebda800e670efbc Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Mon, 5 Oct 2026 13:12:16 +0200 Subject: [PATCH] fix: do not claim service control QTS cannot do QnapQtsDriver inherits LinuxDriver, which now has manage_service() through napalm-device-types' SystemdServicesMixin. QTS has no systemd, so every action would fail. manage_service = None makes every capability check -- is manage_service callable -- answer no, so netOrk offers no controls that cannot work. --- napalm_qnap_qts/qnap_qts.py | 6 ++++++ tests/test_qnap_qts.py | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/napalm_qnap_qts/qnap_qts.py b/napalm_qnap_qts/qnap_qts.py index 6a9ee2e..3e0dd7d 100644 --- a/napalm_qnap_qts/qnap_qts.py +++ b/napalm_qnap_qts/qnap_qts.py @@ -68,6 +68,12 @@ class QnapQtsDriver(StorageDriver, HypervisorDriver, LinuxDriver): driver_name = "qnap_qts" NETMIKO_DEVICE_TYPE = "linux" + #: QTS has no systemd, so the systemctl actions LinuxDriver inherits from + #: napalm-device-types' SystemdServicesMixin would fail on every unit. None + #: makes every "can it control services?" check -- is ``manage_service`` + #: callable -- answer no, rather than offering buttons that cannot work. + manage_service = None # type: ignore[assignment] + SNMP_OBJECT_ID_PREFIX = QNAP_ENTERPRISE_OID SNMP_FINGERPRINT = [ FingerprintRule("qnap", weight=9.0), diff --git a/tests/test_qnap_qts.py b/tests/test_qnap_qts.py index 9a204f6..fd0e99f 100644 --- a/tests/test_qnap_qts.py +++ b/tests/test_qnap_qts.py @@ -182,3 +182,13 @@ class TestDockerBinDiscovery: def test_docker_bin_hook_returns_the_discovered_path(self, driver): driver._docker_path = "/opt/docker" assert driver._docker_bin() == "/opt/docker" + + +def test_services_cannot_be_controlled(): + """QTS has no systemd: the systemctl actions inherited from LinuxDriver would + fail on every unit, so the driver says it cannot control services at all -- + which is what every capability check asks (is ``manage_service`` callable?).""" + from napalm_linux.linux import LinuxDriver + + assert callable(getattr(LinuxDriver, "manage_service", None)) + assert not callable(getattr(QnapQtsDriver, "manage_service", None))