Merge pull request 'fix(driver): load_replace_candidate is None, not a stub that raises (NetOrk/netork#2503)' (#81) from fix/no-config-replace into main
driver / lint (push) Successful in 15s
driver / standard (push) Successful in 17s
driver / lowest (push) Successful in 26s
driver / build (push) Successful in 26s
driver / security (push) Successful in 1m0s
driver / test (3.13) (push) Failing after 13m23s
driver / test (3.12) (push) Failing after 13m25s
driver / types (push) Failing after 13m38s
CI / driver (push) Failing after 13m40s
driver / publish (push) Skipped
driver / lint (push) Successful in 15s
driver / standard (push) Successful in 17s
driver / lowest (push) Successful in 26s
driver / build (push) Successful in 26s
driver / security (push) Successful in 1m0s
driver / test (3.13) (push) Failing after 13m23s
driver / test (3.12) (push) Failing after 13m25s
driver / types (push) Failing after 13m38s
CI / driver (push) Failing after 13m40s
driver / publish (push) Skipped
This commit was merged in pull request #81.
This commit is contained in:
commit
4db8b05ab4
4 files changed
+24
-3
No files matched your search
@@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
`NotImplementedError`.
|
||||
|
||||
### 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).
|
||||
- On an rpm host a package's version carries its epoch where it has one
|
||||
(`1:6.2.0-13.el9`), as on a dpkg host. Oracle's and Red Hat's fixes name it, and without
|
||||
it an epoch-1 fix read as newer than every installed build (NetOrk/netork#2394).
|
||||
|
||||
@@ -91,7 +91,7 @@ with Driver(
|
||||
| `get_config()` | ✅ | Returns `ip addr` + `ip route` output |
|
||||
| `ping()` | ✅ | Executes `ping` on the remote host |
|
||||
| `load_merge_candidate()` | ❌ | Not applicable for generic Linux |
|
||||
| `load_replace_candidate()` | ❌ | Not applicable for generic Linux |
|
||||
| `load_replace_candidate()` | ❌ | Not applicable for generic Linux; `None`, so a caller can tell |
|
||||
| `compare_config()` | ❌ | Not applicable for generic Linux |
|
||||
| `commit_config()` | ❌ | Not applicable for generic Linux |
|
||||
| `discard_config()` | ❌ | Not applicable for generic Linux |
|
||||
|
||||
@@ -1009,8 +1009,8 @@ class LinuxDriver(
|
||||
def load_merge_candidate(self, filename: str = None, config: str = None) -> None: # type: ignore[override]
|
||||
raise NotImplementedError("Config management is not supported for Linux hosts")
|
||||
|
||||
def load_replace_candidate(self, filename: str = None, config: str = None) -> None: # type: ignore[override]
|
||||
raise NotImplementedError("Config management is not supported for Linux hosts")
|
||||
#: No config replace, switched off so a capability check says no (NetOrk/netork#2503).
|
||||
load_replace_candidate = None # type: ignore[assignment]
|
||||
|
||||
def compare_config(self) -> str:
|
||||
raise NotImplementedError("Config management is not supported for Linux hosts")
|
||||
|
||||
@@ -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_linux import LinuxDriver
|
||||
|
||||
|
||||
def test_the_driver_has_no_config_replace():
|
||||
assert LinuxDriver.load_replace_candidate is None
|
||||
assert not callable(getattr(LinuxDriver, "load_replace_candidate", None))
|
||||
Reference in new issue
Block a user