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
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:
1 parent
d226ebf764
commit
b891acd29c
1 file changed
+2
-7
@@ -1466,12 +1466,8 @@ class LinuxDriver(
|
|||||||
return parse_apt_upgradable(self._send(APT_UPGRADABLE_COMMAND, read_timeout=60))
|
return parse_apt_upgradable(self._send(APT_UPGRADABLE_COMMAND, read_timeout=60))
|
||||||
|
|
||||||
def _get_updates_rpm(self) -> list[UpdateDict]:
|
def _get_updates_rpm(self) -> list[UpdateDict]:
|
||||||
"""dnf/yum check-update: exit 100 means updates, 0 none, anything else failed.
|
"""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."""
|
||||||
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``.
|
|
||||||
"""
|
|
||||||
cmd = (
|
cmd = (
|
||||||
"dnf --cacheonly check-update --quiet 2>/dev/null"
|
"dnf --cacheonly check-update --quiet 2>/dev/null"
|
||||||
if self._pkg_manager == "dnf"
|
if self._pkg_manager == "dnf"
|
||||||
@@ -1479,7 +1475,6 @@ class LinuxDriver(
|
|||||||
)
|
)
|
||||||
output, status = _split_status(self._run_privileged(f"{cmd}; echo {_RC_MARKER}$?", 120))
|
output, status = _split_status(self._run_privileged(f"{cmd}; echo {_RC_MARKER}$?", 120))
|
||||||
if status not in (0, 100):
|
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"
|
reason = output[-200:] or "no cached metadata? refresh the package index"
|
||||||
raise RuntimeError(f"{self._pkg_manager} check-update failed (exit {status}): {reason}")
|
raise RuntimeError(f"{self._pkg_manager} check-update failed (exit {status}): {reason}")
|
||||||
security = self._rpm_security_names()
|
security = self._rpm_security_names()
|
||||||
|
|||||||
Reference in new issue
Block a user