all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pmg-api 0/1] fix #2999: make package update notifications configurable
@ 2026-10-19 15:43 Mika Scheer
  2026-10-19 15:43 ` [PATCH pmg-api 1/1] " Mika Scheer
  0 siblings, 1 reply; 2+ messages in thread
From: Mika Scheer @ 2026-10-19 15:43 UTC (permalink / raw)
  To: pmg-devel; +Cc: Mika Scheer

Add a configuration option to configure package update email notifications.
Allows selection between `auto` (current behariour), `always` and `never`.

Heavily inspired by PVE patch: https://bugzilla.proxmox.com/show_bug.cgi?id=1295

Mika Scheer (1):
  fix #2999: make package update notifications configurable

 src/PMG/Config.pm | 15 +++++++++++++++
 src/bin/pmg-daily | 16 +++++++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)

-- 
2.50.1 (Apple Git-155)





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH pmg-api 1/1] fix #2999: make package update notifications configurable
  2026-10-19 15:43 [PATCH pmg-api 0/1] fix #2999: make package update notifications configurable Mika Scheer
@ 2026-10-19 15:43 ` Mika Scheer
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Scheer @ 2026-10-19 15:43 UTC (permalink / raw)
  To: pmg-devel; +Cc: Mika Scheer

Signed-off-by: Mika Scheer <mscheer@cyberfusion.io>
---
 src/PMG/Config.pm | 15 +++++++++++++++
 src/bin/pmg-daily | 16 +++++++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 070a34f..ee8c397 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -196,6 +196,20 @@ EODESC
             format => 'pmg-log-tracker-base',
             default => '/var/log/syslog',
         },
+        'package-updates' => {
+            description =>
+                "Control whether the daily update job should send out notifications.",
+            verbose_description => <<EODESC,
+Control whether the daily update job should send out notifications:
+
+* 'auto' always send a notification for new pending updates on systems with a valid subscription, as those are assumed to be production-ready and thus should know about pending updates.
+* 'always' always send a notification for new pending updates.
+* 'never' never send a notification for new pending updates.
+EODESC
+            type => 'string',
+            enum => ['auto', 'always', 'never'],
+            default => 'auto',
+        },
     };
 }
 
@@ -218,6 +232,7 @@ sub options {
         'admin-mail-from' => { optional => 1 },
         'consent-text' => { optional => 1 },
         'log-tracker-base' => { optional => 1, root_only => 1 },
+        'package-updates' => { optional => 1 },
     };
 }
 
diff --git a/src/bin/pmg-daily b/src/bin/pmg-daily
index 656127b..7a85c8a 100755
--- a/src/bin/pmg-daily
+++ b/src/bin/pmg-daily
@@ -59,10 +59,20 @@ if (my $statlifetime = $cfg->get('admin', 'statlifetime')) {
 }
 
 # check for available updates
-# We assume that users with subscriptions want information
-# about new packages.
 my $info = eval { PMG::API2::Subscription::read_etc_subscription() };
-my $notify = ($info && $info->{status} eq 'active') ? 1 : 0;
+my $notify_on = $cfg->get('admin', 'package-updates') // 'auto';
+my $notify = 0;
+if ($notify_on eq 'auto') {
+    # hosts with subscriptions are likely production system and thus want infos about new packages
+    $notify = ($info && $info->{status} eq 'active') ? 1 : 0;
+} elsif ($notify_on eq 'always') {
+    $notify = 1;
+} elsif ($notify_on eq 'never') {
+    $notify = 0;
+} else {
+    warn "unexpected package-updates  notify configuration value '$notify_on'\n";
+}
+
 eval { PMG::API2::APT->update_database({ node => $nodename, notify => $notify, quiet => 1 }); };
 if (my $err = $@) {
     syslog('err', "update apt database failed: $err");
-- 
2.50.1 (Apple Git-155)





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-22 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 15:43 [PATCH pmg-api 0/1] fix #2999: make package update notifications configurable Mika Scheer
2026-10-19 15:43 ` [PATCH pmg-api 1/1] " Mika Scheer

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal