fix(updates): read dnf and yum updates from the cached metadata (#59) #60

Merged
christianmanivong merged 2 commits from fix/dnf-cache-only into main 2026-11-02 07:22:57 +00:00
Showing only changes of commit b891acd29c - Show all commits
+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()