style(updates): keep linux.py within its recorded length
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 59s
driver / test (3.13) (pull_request) Successful in 52s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m27s
driver / publish (pull_request) Skipped

The quality ratchet records 2142 lines for napalm_linux/linux.py; the docstring of the previous commit took it to 2147.
This commit is contained in:
Christian Manivong committed 2026-11-02 08:18:42 +01:00
1 parent d226ebf764
commit b891acd29c
1 file changed
+2 -7
+2 -7
View File
@@ -1466,12 +1466,8 @@ class LinuxDriver(
return parse_apt_upgradable(self._send(APT_UPGRADABLE_COMMAND, read_timeout=60))
def _get_updates_rpm(self) -> list[UpdateDict]:
"""dnf/yum check-update: exit 100 means updates, 0 none, anything else failed.
It reads the cached metadata only, as apt reads its local index: with an
expired cache dnf downloaded the repositories' metadata first, which
outlasted the whole poll (#59). Refreshing is ``refresh_available_updates``.
"""
"""dnf/yum check-update on the cached metadata only, as apt reads its local index
(#59): exit 100 means updates, 0 none, anything else failed."""
cmd = (
"dnf --cacheonly check-update --quiet 2>/dev/null"
if self._pkg_manager == "dnf"
@@ -1479,7 +1475,6 @@ class LinuxDriver(
)
output, status = _split_status(self._run_privileged(f"{cmd}; echo {_RC_MARKER}$?", 120))
if status not in (0, 100):
# Without cached metadata --cacheonly fails at once, and stderr is gone.
reason = output[-200:] or "no cached metadata? refresh the package index"
raise RuntimeError(f"{self._pkg_manager} check-update failed (exit {status}): {reason}")
security = self._rpm_security_names()