node-exporter-textfile-collector-scripts icon indicating copy to clipboard operation
node-exporter-textfile-collector-scripts copied to clipboard

apt_info.py: fix apt_upgrades_pending and apt_upgrades_held

Open kennethso168 opened this issue 1 year ago • 1 comments

Fixes #193

Fixed apt_upgrades_pending always empty, as after #181, cache.upgrade(True) is no longer called in script. This call marks the packages that could be upgraded, and without it, no package has the marked_upgrade boolean set to true. Changed to filter all packages that are installed and upgradable. This should match the output of apt list --upgradable

Also fixed apt_upgrades_held including all upgradable packages including packages that are not actually held. Package can be detected to be held according to https://askubuntu.com/a/965543.

kennethso168 avatar Mar 10 '24 03:03 kennethso168

i can confirm the apt_upgrades_pending is now working

calvinbui avatar Mar 16 '24 12:03 calvinbui

Could this be merged by anyone? Can confirm it's working too.

leahoswald avatar Apr 16 '24 10:04 leahoswald

phased updates aren't working with apt_upgrades_held. the packages are listed as upgradable in apt_upgrades_pending, even though they are being kept back.

❯ sudo apt full-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  cloud-init python3-update-manager update-manager-core
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

image

calvinbui avatar Apr 27 '24 06:04 calvinbui

@calvinbui Please open a new issue to track the phased updates functionality. AFAIK, testing a package's state for SELSTATE_HOLD relates to packages that have been manually held, i.e. with apt-mark hold. If you know of a way to test whether a package is being held back due to being part of a phased update, please submit a PR.

dswarbrick avatar Apr 27 '24 12:04 dswarbrick