public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH cluster 1/5 v2] Close #1295: Add notifications to datacenter schema
@ 2021-07-14 10:09 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
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dominic Jäger @ 2021-07-14 10:09 UTC (permalink / raw)
  To: pve-devel

Permits controlling email notifications about package updates.
Use property string for extensibility to more notification types.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
v2: Use property string

 data/PVE/DataCenterConfig.pm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm
index 24ebf3f..336f68a 100644
--- a/data/PVE/DataCenterConfig.pm
+++ b/data/PVE/DataCenterConfig.pm
@@ -25,6 +25,15 @@ my $migration_format = {
     },
 };
 
+my $notify_format = {
+    package_updates => {
+	type => 'boolean',
+	description => 'Control notifications about available package updates',
+	format_description => 'boolean',
+	optional => 1,
+    },
+};
+
 my $ha_format = {
     shutdown_policy => {
 	type => 'string',
@@ -146,6 +155,12 @@ my $datacenter_schema = {
 	    format => 'email-opt',
 	    description => "Specify email address to send notification from (default is root@\$hostname)",
 	},
+	notify => {
+	    optional => 1,
+	    type => 'string',
+	    format => $notify_format,
+	    description => 'Control email notifications',
+	},
 	max_workers => {
 	    optional => 1,
 	    type => 'integer',
@@ -196,6 +211,10 @@ sub parse_datacenter_config {
 	$res->{migration} = PVE::JSONSchema::parse_property_string($migration_format, $migration);
     }
 
+    if (my $notify = $res->{notify}) {
+	$res->{notify} = PVE::JSONSchema::parse_property_string($notify_format, $notify);
+    }
+
     if (my $ha = $res->{ha}) {
 	$res->{ha} = PVE::JSONSchema::parse_property_string($ha_format, $ha);
     }
@@ -241,6 +260,11 @@ sub write_datacenter_config {
 	$cfg->{migration} = PVE::JSONSchema::print_property_string($migration, $migration_format);
     }
 
+    if (ref($cfg->{notify})) {
+	my $notify = $cfg->{notify};
+	$cfg->{notify} = PVE::JSONSchema::print_property_string($notify, $notify_format);
+    }
+
     if (ref($cfg->{ha})) {
 	my $ha = $cfg->{ha};
 	$cfg->{ha} = PVE::JSONSchema::print_property_string($ha, $ha_format);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-14 10:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pve-devel] [PATCH manager 3/5 v2] Close #1295: Make apt notifications configurable Dominic Jäger
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

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