feat: switch off the fix templates QTS cannot take (0.4.0)
CI / test (3.10) (push) Failing after 25s
CI / test (3.11) (push) Failing after 23s
CI / test (3.12) (push) Failing after 26s
CI / test (3.10) (pull_request) Failing after 23s
CI / test (3.11) (pull_request) Failing after 19s
CI / test (3.12) (pull_request) Failing after 25s

napalm-linux 0.8 implements napalm-device-types' fix templates. QTS has
no apt, dnf or opkg and sets its SNMP agent in its own UI, so
configure_snmp_agent, configure_package_proxy and ensure_package are
None here: a capability check answers no instead of offering a fix
that fails, as the inherited fix_snmp and fix_apt_proxy did.

get_device_warnings returns nothing: the inherited one asked for
updates, which is None here, and logged a TypeError on every poll.

The role test follows napalm-linux's get_os_users.

Closes #6. Part of #7.
This commit is contained in:
Christian Manivong committed 2026-10-17 00:53:56 +02:00
1 parent 088d47f47c
commit 742b8f044b
4 files changed
+44 -4

No files matched your search

+12
View File
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [0.4.0] – 2026-10-17
### Changed
- Requires napalm-linux 0.8.0, whose fixes are napalm-device-types' templates.
`configure_snmp_agent`, `configure_package_proxy` and `ensure_package` are switched
off (`None`): QTS has no apt, dnf or opkg, and its SNMP agent is set in its own UI.
Before, the inherited SNMP and apt-proxy fixes were offered and failed.
### Fixed
- `get_device_warnings` no longer logs a TypeError on every poll: the inherited one
asked for updates, which QTS cannot list (#6).
## [0.3.0] – 2026-10-08 ## [0.3.0] – 2026-10-08
### Removed ### Removed
+9
View File
@@ -78,6 +78,15 @@ class QnapQtsDriver(StorageDriver, HypervisorDriver, LinuxDriver):
get_available_updates = None # type: ignore[assignment] get_available_updates = None # type: ignore[assignment]
refresh_available_updates = None # type: ignore[assignment] refresh_available_updates = None # type: ignore[assignment]
apply_updates = None # type: ignore[assignment] apply_updates = None # type: ignore[assignment]
#: The fix templates LinuxDriver carries need a package manager or net-snmp
#: from packages; QTS has neither, and its SNMP agent is set in its own UI.
configure_snmp_agent = None # type: ignore[assignment]
configure_package_proxy = None # type: ignore[assignment]
ensure_package = None # type: ignore[assignment]
def get_device_warnings(self) -> list:
"""Nothing to report: the inherited one asks for updates QTS cannot list."""
return []
SNMP_OBJECT_ID_PREFIX = QNAP_ENTERPRISE_OID SNMP_OBJECT_ID_PREFIX = QNAP_ENTERPRISE_OID
SNMP_FINGERPRINT = [ SNMP_FINGERPRINT = [
+2 -2
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "napalm-qnap-qts" name = "napalm-qnap-qts"
version = "0.3.0" version = "0.4.0"
description = "NAPALM driver for QNAP NAS systems running QTS via SSH" description = "NAPALM driver for QNAP NAS systems running QTS via SSH"
readme = "README.md" readme = "README.md"
requires-python = ">=3.9" requires-python = ">=3.9"
@@ -44,7 +44,7 @@ classifiers = [
dependencies = [ dependencies = [
"napalm>=4.0", "napalm>=4.0",
"napalm-device-types>=2.6.0", "napalm-device-types>=2.6.0",
"napalm-linux>=0.3.0", "napalm-linux>=0.8.0",
"netmiko>=4.0.0", "netmiko>=4.0.0",
"paramiko>=5.0.0", # CVE-2026-44405 "paramiko>=5.0.0", # CVE-2026-44405
] ]
+21 -2
View File
@@ -10,8 +10,8 @@ from __future__ import annotations
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
import pytest import pytest
from napalm_device_types import primary_role_of, role_keys_of from napalm_device_types import primary_role_of, role_keys_of
from napalm_qnap_qts import QnapQtsDriver from napalm_qnap_qts import QnapQtsDriver
#: Parsers need real command output to be written against. These tests are the #: Parsers need real command output to be written against. These tests are the
@@ -97,7 +97,7 @@ class TestRolesDoNotShadowLinux:
collision. There is nothing left to collide with. collision. There is nothing left to collide with.
""" """
@pytest.mark.parametrize("method", ["get_services", "get_users"]) @pytest.mark.parametrize("method", ["get_services", "get_os_users"])
def test_os_surface_resolves_to_linux(self, method): def test_os_surface_resolves_to_linux(self, method):
"""QTS really is Linux for these, so inheriting them is correct.""" """QTS really is Linux for these, so inheriting them is correct."""
from napalm_linux.linux import LinuxDriver from napalm_linux.linux import LinuxDriver
@@ -224,3 +224,22 @@ def test_updates_are_not_read_or_applied_here():
methods are callable.""" methods are callable."""
for method in ("get_available_updates", "refresh_available_updates", "apply_updates"): for method in ("get_available_updates", "refresh_available_updates", "apply_updates"):
assert not callable(getattr(QnapQtsDriver, method, None)), method assert not callable(getattr(QnapQtsDriver, method, None)), method
class TestFixesQtsCannotTake:
"""QTS has no apt, dnf or opkg, and its SNMP agent is configured in its own UI:
the fix templates inherited from LinuxDriver are switched off (#7), so a
capability check -- is it callable? -- answers no."""
@pytest.mark.parametrize(
"name", ["configure_snmp_agent", "configure_package_proxy", "ensure_package"]
)
def test_switched_off(self, name):
assert getattr(QnapQtsDriver, name) is None
def test_device_warnings_do_not_ask_for_updates_qts_cannot_list():
"""The inherited get_device_warnings called get_available_updates, which is
None here, and logged a TypeError on every poll (#6)."""
driver = QnapQtsDriver("nas", "admin", "pw")
assert driver.get_device_warnings() == []