From 27027eec560cf4c6c74953cc50c01eece42e8a6a Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Fri, 21 Aug 2026 12:50:10 +0700 Subject: [PATCH] refactor!: keep one name for pending updates, drop the alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver implemented get_pending_updates and then carried get_available_updates as a one-line alias, because netOrk's API only ever called the latter. Two names for one thing, with the driver bridging the gap. napalm-device-types v1.0 collapses them onto get_available_updates — the name four drivers and every netOrk call site already used — so the alias has nothing left to bridge. BREAKING CHANGE: get_pending_updates is gone; call get_available_updates. The seven pre-existing test failures in this repo are untouched and unrelated; see netork#110. --- napalm_linux/linux.py | 6 +----- tests/test_linux.py | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/napalm_linux/linux.py b/napalm_linux/linux.py index 1c07142..07b9377 100644 --- a/napalm_linux/linux.py +++ b/napalm_linux/linux.py @@ -1019,7 +1019,7 @@ class LinuxDriver(OSDriver): success = not any(kw in low for kw in ("error:", "failed", "not found", "is not installed", "no packages")) return {"success": success, "output": raw.strip()} - def get_pending_updates(self) -> list[UpdateDict]: + def get_available_updates(self) -> list[UpdateDict]: if self._pkg_manager == "apt": return self._get_updates_apt() if self._pkg_manager in ("dnf", "yum"): @@ -1032,10 +1032,6 @@ class LinuxDriver(OSDriver): f"Package manager '{self._pkg_manager}' is not supported" ) - def get_available_updates(self) -> list[UpdateDict]: - """Alias for get_pending_updates(); called by the netork API backend.""" - return self.get_pending_updates() - def get_device_warnings(self) -> List[dict[str, Any]]: """Return warning dicts for issues detected on this device. diff --git a/tests/test_linux.py b/tests/test_linux.py index d690295..41c8ed1 100644 --- a/tests/test_linux.py +++ b/tests/test_linux.py @@ -166,7 +166,7 @@ def test_get_packages_apt(driver): # --------------------------------------------------------------------------- -# get_pending_updates (apt) +# get_available_updates (apt) # --------------------------------------------------------------------------- @@ -177,10 +177,10 @@ APT_UPGRADABLE = ( ) -def test_get_pending_updates_apt(driver): +def test_get_available_updates_apt(driver): driver._pkg_manager = "apt" with patch.object(driver, "_send", side_effect=["", APT_UPGRADABLE]): - updates = driver.get_pending_updates() + updates = driver.get_available_updates() assert len(updates) == 2 assert updates[0]["name"] == "openssh-server" assert updates[0]["current_version"] == "1:9.2p1-2+deb12u1"