public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-backup v3 2/2] notifications/pbsXtoX: adapt to proxmox-apt making old_version optional
Date: Wed, 19 Nov 2025 15:06:06 +0100	[thread overview]
Message-ID: <20251119140609.230763-9-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251119140609.230763-1-s.sterz@proxmox.com>

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
---
 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



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-11-19 14:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 14:05 [pdm-devel] [PATCH datacenter-manager/proxmox{, -backup}/widget-toolkit v3 00/10] unstable flag and pdm api viewer Shannon Sterz
2025-11-19 14:05 ` [pdm-devel] [PATCH proxmox v3 1/5] router/api-macro: add unstable flag for ApiMethod Shannon Sterz
2025-11-19 14:06 ` [pdm-devel] [PATCH proxmox v3 2/5] pve-api-types: generate array objects Shannon Sterz
2025-11-19 14:06 ` [pdm-devel] [PATCH proxmox v3 3/5] pve-api-types: fix clippy lints Shannon Sterz
2025-11-19 14:06 ` [pdm-devel] [PATCH proxmox v3 4/5] docgen: add docgen crate Shannon Sterz
2025-11-19 14:06 ` [pdm-devel] [PATCH proxmox v3 5/5] docgen: add support for the new stable flag Shannon Sterz
2025-11-19 14:06 ` [pdm-devel] [PATCH widget-toolkit v3 1/1] api viewer: add support for endpoints that are marked as unstable Shannon Sterz
2025-11-19 14:06 ` [pdm-devel] [PATCH proxmox-backup v3 1/2] docgen: use proxmox-rs docgen crate Shannon Sterz
2025-11-19 14:06 ` Shannon Sterz [this message]
2025-11-19 14:06 ` [pdm-devel] [PATCH datacenter-manager v3 1/2] docgen: switch to " Shannon Sterz
2025-11-19 14:06 ` [pdm-devel] [PATCH datacenter-manager v3 2/2] api-viewer: add an api-viewer package Shannon Sterz

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=20251119140609.230763-9-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pdm-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal