public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-mail-forward 5/5] only ever forward for one product, favoring PVE over PBS over PDM
Date: Thu,  9 Apr 2026 15:27:21 +0200	[thread overview]
Message-ID: <20260409132721.272178-6-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260409132721.272178-1-l.wagner@proxmox.com>

Co-installations of products should hopefully be not that common, but a
defined order might be easier to grasp for users than having to deal
with notifications being sent through multiple products.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 src/main.rs | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 92a2804..b089bb0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,6 +6,9 @@
 //! The message is passed via stdin.
 //! The binary is installed with setuid permissions and will thus run as
 //! root (euid ~ root, ruid ~ nobody)
+//!
+//! If multiple products are co-installed, only one of the products is ever responsible for
+//! forwarding the email. The order is PVE > PBS > PDM.
 
 use std::io::Read;
 use std::path::Path;
@@ -137,22 +140,18 @@ fn main() {
     // Read the mail that is to be forwarded from stdin
     match read_stdin() {
         Ok(mail) => {
-            // Assume a PVE installation if /etc/pve exists
             if Path::new(PVE_CFG_PATH).exists() {
+                // Assume a PVE installation if /etc/pve exists
                 if let Err(err) = forward_for_pve(&mail) {
                     error!("could not forward mail for Proxmox VE: {err:#}");
                 }
-            }
-
-            // Assume a PBS installation if /etc/proxmox-backup exists
-            if Path::new(PBS_CFG_PATH).exists() {
+            } else if Path::new(PBS_CFG_PATH).exists() {
+                // Assume a PBS installation if /etc/proxmox-backup exists
                 if let Err(err) = forward_for_pbs(&mail) {
                     error!("could not forward mail for Proxmox Backup Server: {err:#}");
                 }
-            }
-
-            // Assume a PDM installation if /etc/proxmox-datacenter-manager exists
-            if Path::new(PDM_CFG_PATH).exists() {
+            } else if Path::new(PDM_CFG_PATH).exists() {
+                // Assume a PDM installation if /etc/proxmox-datacenter-manager exists
                 if let Err(err) = forward_for_pdm(&mail) {
                     error!("could not forward mail for Proxmox Datacenter Manager: {err:#}");
                 }
-- 
2.47.3





  parent reply	other threads:[~2026-04-09 13:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09 13:27 [PATCH proxmox{-backup,-mail-forward} 0/5] forward mails through notification worker; PDM compatibility Lukas Wagner
2026-04-09 13:27 ` [PATCH proxmox-backup 1/5] notifications: move spool directory to /var/lib/proxmox-backup/notifications/queue Lukas Wagner
2026-04-09 14:52   ` Arthur Bied-Charreton
2026-04-09 13:27 ` [PATCH proxmox-backup 2/5] pull in 'mail-forwarder' feature for proxmox-notify Lukas Wagner
2026-04-09 14:54   ` Arthur Bied-Charreton
2026-04-09 13:27 ` [PATCH proxmox-mail-forward 3/5] forward using PBS' notification worker Lukas Wagner
2026-04-09 15:03   ` Arthur Bied-Charreton
2026-04-09 13:27 ` [PATCH proxmox-mail-forward 4/5] forward mails on PDM installations as well Lukas Wagner
2026-04-09 15:06   ` Arthur Bied-Charreton
2026-04-09 13:27 ` Lukas Wagner [this message]
2026-04-09 15:15   ` [PATCH proxmox-mail-forward 5/5] only ever forward for one product, favoring PVE over PBS over PDM Arthur Bied-Charreton

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=20260409132721.272178-6-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pbs-devel@lists.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