all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Dominic Jäger" <d.jaeger@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 3/5 v2] Close #1295: Make apt notifications configurable
Date: Wed, 14 Jul 2021 12:09:31 +0200	[thread overview]
Message-ID: <20210714100933.54491-3-d.jaeger@proxmox.com> (raw)
In-Reply-To: <20210714100933.54491-1-d.jaeger@proxmox.com>

Users may want turn off update notifications.
Depends on pve-cluster patch.

Signed-off-by: Dominic Jäger <d.jaeger@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





  parent reply	other threads:[~2021-07-14 10:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 10:09 [pve-devel] [PATCH cluster 1/5 v2] Close #1295: Add notifications to datacenter schema Dominic Jäger
2021-07-14 10:09 ` [pve-devel] [PATCH manager 2/5 v2] apt update: Inform users about missing subscriptions Dominic Jäger
2021-07-14 10:09 ` Dominic Jäger [this message]
2021-07-14 10:09 ` [pve-devel] [PATCH manager 4/5 v2] dc options: Add apt notifications GUI checkbox Dominic Jäger
2021-07-14 10:09 ` [pve-devel] [PATCH manager 5/5 v2] dc options: Allow both package_update options Dominic Jäger

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=20210714100933.54491-3-d.jaeger@proxmox.com \
    --to=d.jaeger@proxmox.com \
    --cc=pve-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 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