From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C73F11FF17E for ; Thu, 13 Nov 2025 13:53:56 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B9A571B45F; Thu, 13 Nov 2025 13:54:51 +0100 (CET) From: Shannon Sterz To: pbs-devel@lists.proxmox.com Date: Thu, 13 Nov 2025 13:54:17 +0100 Message-ID: <20251113125417.376817-1-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1763038432483 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.062 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup v2] notifications/pbsXtoX: adapt to proxmox-apt making old_version optional X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Shannon Sterz --- 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, } /// 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