public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
	"Dominic Jäger" <d.jaeger@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 2/2] Close #1295: Make apt notifications configurable
Date: Wed, 7 Apr 2021 10:51:43 +0200	[thread overview]
Message-ID: <1f8805e2-27e2-57fb-b49c-cd7767d0c09f@proxmox.com> (raw)
In-Reply-To: <20210407083045.62463-2-d.jaeger@proxmox.com>

On 07.04.21 10:30, Dominic Jäger wrote:
> 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@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;

We may want to keep the default value the same, i.e.:

my $notify = $dccfg->{notify_updates} // ($info && $info->{status} eq 'Active');

or if it's important that the perl "boolean" is stricly 0 or 1 then:

my $notify_default = ($info && $info->{status} eq 'Active') ? 1 : 0;
my $notify = $dccfg->{notify_updates} // $notify_default;


(the following is actually meant for the pve-cluster patch):
I'd really prefer using a colon for new config property entries, and I can imagine
that there will be more such switches in the future, so maybe start out with a format
sting (like migration is there) and have something like:

'notify: package-updates=1'

what do you think?


>  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',
> 





  reply	other threads:[~2021-04-07  8:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  8:30 [pve-devel] [PATCH pve-cluster 1/2] Close #1295: Add notify_updates to datacenter schema Dominic Jäger
2021-04-07  8:30 ` [pve-devel] [PATCH manager 2/2] Close #1295: Make apt notifications configurable Dominic Jäger
2021-04-07  8:51   ` Thomas Lamprecht [this message]
2021-04-08  9:21     ` Dominic Jäger
2021-04-08  9:28       ` Thomas Lamprecht
2021-04-08 10:02 Dietmar Maurer

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=1f8805e2-27e2-57fb-b49c-cd7767d0c09f@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal