[pve-devel] [PATCH manager 3/5 v2] Close #1295: Make apt notifications configurable
Dominic Jäger
d.jaeger at proxmox.com
Wed Jul 14 12:09:31 CEST 2021
Users may want turn off update notifications.
Depends on pve-cluster patch.
Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
v2: Keep defaults. I hope that I understood the idea correctly.
bin/pveupdate | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/bin/pveupdate b/bin/pveupdate
index 99b52fe9..5981b82c 100755
--- a/bin/pveupdate
+++ b/bin/pveupdate
@@ -50,9 +50,14 @@ 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 $has_subscription = $info && $info->{status} eq 'Active';
+
+my $notification_settings = $dccfg && $dccfg->{notify};
+my $notify_package_updates = $notification_settings->{package_updates}
+ if $notification_settings;
+
+# We assume that users with subscriptions want information about new packages
+my $notify = $notify_package_updates // $has_subscription;
eval { PVE::API2::APT->update_database({ node => $nodename, notify => $notify, quiet => 1 }); };
if (my $err = $@) {
syslog ('err', "update apt database failed: $err");
--
2.30.2
More information about the pve-devel
mailing list