Package: release.debian.org
Severity: normal
Tags: bookworm
X-Debbugs-Cc: prometheus-node-exporter-collect...@packages.debian.org, Debian
Go Packaging Team , Daniel Swarbrick
, Martina Ferrari
Control: affects -1 + src:prometheus-node-exporter-collectors
User: release.debian@packages.debian.org
Usertags: pu
[ Reason ]
The version in Debian stable suffers from:
https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/issues/193
which causes upgrades no to appear in apt_upgrades_pending but only in
apt_upgrades_held. This is tracked in debian as #1077694
This was fixed with upstream PR:
https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/pull/207
[ Impact ]
This bug leads to the collector not reporting on pending package upgrades and
can lead to system administrators miss to install critical software updates
[ Tests ]
This change was installed on my (siretart's) homelab cluster and confirmed to
work there.
[ Risks ]
low. The code change is easy to review and understand.
[ Checklist ]
[x] *all* changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in (old)stable
[x] the issue is verified as fixed in unstable
diff --git a/debian/changelog b/debian/changelog
index 3233700..b514460 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+prometheus-node-exporter-collectors (0.0~git20230203.6f710f8-1+deb12u3)
bookworm; urgency=medium
+
+ * Team upload
+ * apt_info.py: fix apt_upgrades_pending and apt_upgrades_held, Closes:
#1077694
+
+ -- Reinhard Tartler Wed, 06 Nov 2024 20:15:44 -0500
+
prometheus-node-exporter-collectors (0.0~git20230203.6f710f8-1+deb12u2)
bookworm; urgency=medium
* Team upload
diff --git
a/debian/patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch
b/debian/patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch
new file mode 100644
index 000..6af357f
--- /dev/null
+++
b/debian/patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch
@@ -0,0 +1,35 @@
+From: Reinhard Tartler
+Date: Sat, 2 Nov 2024 08:20:41 -0400
+Subject: apt_info.py: fix apt_upgrades_pending and apt_upgrades_held
+
+Backported from
+https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/pull/207
+---
+ apt_info.py | 7 +--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/apt_info.py b/apt_info.py
+index 82ea4e5..804f89c 100755
+--- a/apt_info.py
b/apt_info.py
+@@ -57,7 +57,7 @@ def _write_pending_upgrades(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_upgradable
+ }
+ _write_upgrade_info("apt_upgrades_pending", candidates)
+
+@@ -66,7 +66,10 @@ def _write_held_upgrades(cache):
+ print("# HELP apt_upgrades_held Apt packages pending updates but held
back.")
+ print("# TYPE apt_upgrades_held gauge")
+
+-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
++}
+ _write_upgrade_info("apt_upgrades_held", held_candidates)
+
+
diff --git a/debian/patches/series b/debian/patches/series
index f5329fc..8ee1d54 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
0001-do-not-run-apt-update-or-simulate-apt-dist-upgrade.patch
0001-report-the-apt-cache-timestamp.patch
0001-use-a-better-heuristic-for-the-apt-update-last-run-t.patch
+0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch