From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 851D575EB6 for ; Wed, 14 Jul 2021 12:10:23 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7E445F471 for ; Wed, 14 Jul 2021 12:09:53 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id BC756F437 for ; Wed, 14 Jul 2021 12:09:51 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8E1E94105A for ; Wed, 14 Jul 2021 12:09:51 +0200 (CEST) From: =?UTF-8?q?Dominic=20J=C3=A4ger?= To: pve-devel@lists.proxmox.com Date: Wed, 14 Jul 2021 12:09:31 +0200 Message-Id: <20210714100933.54491-3-d.jaeger@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210714100933.54491-1-d.jaeger@proxmox.com> References: <20210714100933.54491-1-d.jaeger@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 1.225 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager 3/5 v2] Close #1295: Make apt notifications configurable X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 10:10:23 -0000 Users may want turn off update notifications. Depends on pve-cluster patch. Signed-off-by: Dominic Jäger --- 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