Merge pull request 'fix(driver): load_replace_candidate is None, not a stub that raises (NetOrk/netork#2503)' (#7) from fix/no-config-replace into main
driver / standard (push) Successful in 14s
driver / lint (push) Successful in 12s
driver / test (3.12) (push) Successful in 47s
driver / types (push) Successful in 54s
driver / lowest (push) Successful in 22s
driver / test (3.13) (push) Successful in 46s
driver / build (push) Successful in 27s
driver / security (push) Successful in 57s
CI / driver (push) Successful in 2m16s
driver / publish (push) Skipped

This commit was merged in pull request #7.
This commit is contained in:
christianmanivong committed 2026-11-13 21:39:06 +00:00
commit d2a3f8c89d
3 files changed
+24 -4

No files matched your search

+4
View File
@@ -7,6 +7,10 @@ All notable changes to this driver. The format follows
## [Unreleased]
### Changed
- `load_replace_candidate` is `None` instead of a method that raises
`NotImplementedError`, so a caller that asks whether the driver can replace a
configuration gets no. netOrk offered a config restore for these devices that
could only fail (NetOrk/netork#2503).
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
+3 -4
View File
@@ -199,10 +199,9 @@ class YealinkDriver(PhoneDriver):
def cli(self, commands: list[str], encoding: str = "text") -> dict:
raise NotImplementedError
def load_replace_candidate(
self, filename: str | None = None, config: str | None = None
) -> None:
raise NotImplementedError
#: No config replace: switched off rather than a stub that raises, so asking
#: whether the driver has one says no (NetOrk/netork#2503).
load_replace_candidate = None # type: ignore[assignment]
def load_merge_candidate(self, filename: str | None = None, config: str | None = None) -> None:
raise NotImplementedError
+17
View File
@@ -0,0 +1,17 @@
"""The driver cannot replace a device's configuration, and says so by not having the method.
A ``load_replace_candidate`` that only raises looks like a replace to anyone who asks
whether the driver has one: netOrk offered a config restore for these devices that
could only fail (NetOrk/netork#2503). ``None`` is how a driver switches off a method
it would otherwise inherit, the convention of napalm-device-types and netOrk's
capability checks.
"""
from __future__ import annotations
from napalm_yealink import YealinkDriver
def test_the_driver_has_no_config_replace():
assert YealinkDriver.load_replace_candidate is None
assert not callable(getattr(YealinkDriver, "load_replace_candidate", None))