From: Shannon Sterz <s.sterz@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v2] notifications/pbsXtoX: adapt to proxmox-apt making old_version optional
Date: Thu, 13 Nov 2025 13:54:17 +0100 [thread overview]
Message-ID: <20251113125417.376817-1-s.sterz@proxmox.com> (raw)
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
changes since v1:
* adapted `installed_version` in `UpgradablePackage` to accept the new
optional value. also adapts the handlebar template there to render
properly when `installed_version` is None. thanks @ Thomas Lamprecht
* add adaptions to pbs2to3 and pbs3to4
src/bin/pbs2to3.rs | 4 ++--
src/bin/pbs3to4.rs | 4 ++--
src/server/notifications/template_data.rs | 2 +-
templates/default/package-updates-body.txt.hbs | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/bin/pbs2to3.rs b/src/bin/pbs2to3.rs
index f5a3cce6..6f9ad9d1 100644
--- a/src/bin/pbs2to3.rs
+++ b/src/bin/pbs2to3.rs
@@ -88,9 +88,9 @@ impl Checker {
.iter()
.find(|pkg| pkg.package.as_str() == PROXMOX_BACKUP_META);
- if let Some(pbs_meta_pkg) = pbs_meta_pkg {
+ if let Some(old_version) = pbs_meta_pkg.and_then(|m| m.old_version.as_ref()) {
let pkg_version = Regex::new(r"^(\d+)\.(\d+)[.-](\d+)")?;
- let captures = pkg_version.captures(&pbs_meta_pkg.old_version);
+ let captures = pkg_version.captures(old_version);
if let Some(captures) = captures {
let maj = Self::extract_version_from_captures(1, &captures)?;
let min = Self::extract_version_from_captures(2, &captures)?;
diff --git a/src/bin/pbs3to4.rs b/src/bin/pbs3to4.rs
index 1d99a592..8f0bfc0d 100644
--- a/src/bin/pbs3to4.rs
+++ b/src/bin/pbs3to4.rs
@@ -89,9 +89,9 @@ impl Checker {
.iter()
.find(|pkg| pkg.package.as_str() == PROXMOX_BACKUP_META);
- if let Some(pbs_meta_pkg) = pbs_meta_pkg {
+ if let Some(old_version) = pbs_meta_pkg.and_then(|m| m.old_version.as_ref()) {
let pkg_version = Regex::new(r"^(\d+)\.(\d+)[.-](\d+)")?;
- let captures = pkg_version.captures(&pbs_meta_pkg.old_version);
+ let captures = pkg_version.captures(old_version);
if let Some(captures) = captures {
let maj = Self::extract_version_from_captures(1, &captures)?;
let min = Self::extract_version_from_captures(2, &captures)?;
diff --git a/src/server/notifications/template_data.rs b/src/server/notifications/template_data.rs
index 0dcc5ed3..88e49a03 100644
--- a/src/server/notifications/template_data.rs
+++ b/src/server/notifications/template_data.rs
@@ -154,7 +154,7 @@ pub struct UpgradablePackage {
/// The new version which can be installed.
available_version: String,
/// The currently installed version.
- installed_version: String,
+ installed_version: Option<String>,
}
/// Template data for the package-updates template.
diff --git a/templates/default/package-updates-body.txt.hbs b/templates/default/package-updates-body.txt.hbs
index 9800ab5c..61f5eec3 100644
--- a/templates/default/package-updates-body.txt.hbs
+++ b/templates/default/package-updates-body.txt.hbs
@@ -1,6 +1,6 @@
Proxmox Backup Server has the following updates available:
{{#each available-updates}}
- {{this.package-name}}: {{this.installed-version}} -> {{this.available-version}}
+ {{this.package-name}}: {{#if this.installed-version}}{{this.installed-version}} ->{{else}}NEW,{{/if}} {{this.available-version}}
{{/each}}
To upgrade visit the web interface:
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next reply other threads:[~2025-11-13 12:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 12:54 Shannon Sterz [this message]
2025-11-13 13:06 ` Lukas Wagner
2025-11-14 8:49 ` [pbs-devel] applied: " Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251113125417.376817-1-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.