[pve-devel] [PATCH manager 2/2] Close #1295: Make apt notifications configurable

Dominic Jäger d.jaeger at proxmox.com
Wed Apr 7 10:30:45 CEST 2021


This way all users, including subscription users, can decide if they want to
receive notifications mails from pveupdate or not. Disabling notifications is
desirable if available updates are monitored externally, for example.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
 bin/pveupdate                 | 4 +---
 www/manager6/dc/OptionView.js | 5 +++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/pveupdate b/bin/pveupdate
index 99b52fe9..37e6e518 100755
--- a/bin/pveupdate
+++ b/bin/pveupdate
@@ -50,9 +50,7 @@ if (my $err = $@) {
 }
 
 my $info = PVE::INotify::read_file('subscription');
-# We assume that users with subscriptions want informations
-# about new packages.
-my $notify = ($info && $info->{status} eq 'Active') ? 1 : 0;
+my $notify = $dccfg->{notify_updates} // 1;
 eval { PVE::API2::APT->update_database({ node => $nodename, notify => $notify, quiet => 1 }); };
 if (my $err = $@) {
     syslog ('err', "update apt database failed: $err");
diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index 0e783cf4..b36acd07 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -92,6 +92,11 @@ Ext.define('PVE.dc.OptionView', {
 	    vtype: 'proxmoxMail',
 	    defaultValue: 'root@$hostname',
 	});
+	me.add_boolean_row(
+	    'notify_updates',
+	    gettext('Notify about updates'),
+	    { defaultValue: 1 },
+	);
 	me.add_text_row('mac_prefix', gettext('MAC address prefix'), {
 	    deleteEmpty: true,
 	    vtype: 'MacPrefix',
-- 
2.20.1





More information about the pve-devel mailing list