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.jae...@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', > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel