Skip to content

Commit

Permalink
apt_info.py: fix apt_upgrades_pending and apt_upgrades_held
Browse files Browse the repository at this point in the history
Signed-off-by: kennethso168 <[email protected]>
  • Loading branch information
kennethso168 authored Mar 10, 2024
1 parent ef8c077 commit 093a1fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apt_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _write_pending_upgrades(registry, cache):
# only one upgrade, not two). See the following issue for more details:
# https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/issues/85
candidates = {
p.candidate for p in cache.get_changes() if p.is_installed and p.marked_upgrade
p.candidate for p in cache if p.is_installed and p.is_upgradable
}
upgrade_list = _convert_candidates_to_upgrade_infos(candidates)

Expand All @@ -69,7 +69,9 @@ def _write_pending_upgrades(registry, cache):


def _write_held_upgrades(registry, cache):
held_candidates = {p.candidate for p in cache if p.is_upgradable and p.marked_keep}
held_candidates = {
p.candidate for p in cache if p.is_upgradable and p._pkg.selected_state == apt_pkg.SELSTATE_HOLD
}
upgrade_list = _convert_candidates_to_upgrade_infos(held_candidates)

if upgrade_list:
Expand Down

0 comments on commit 093a1fe

Please sign in to comment.