[pve-devel] [PATCH manager 1/7] api: cluster/metricserver: prevent simultaneosly setting and deleting of property

Dominik Csapak d.csapak at proxmox.com
Wed Dec 2 10:21:06 CET 2020


like we do in other apis of section configs (e.g. storage)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Cluster/MetricServer.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/API2/Cluster/MetricServer.pm b/PVE/API2/Cluster/MetricServer.pm
index 9a14985e..ec3c7b75 100644
--- a/PVE/API2/Cluster/MetricServer.pm
+++ b/PVE/API2/Cluster/MetricServer.pm
@@ -213,6 +213,8 @@ __PACKAGE__->register_method ({
 		    my $d = $options->{$k} || die "no such option '$k'\n";
 		    die "unable to delete required option '$k'\n" if !$d->{optional};
 		    die "unable to delete fixed option '$k'\n" if $d->{fixed};
+		    die "cannot set and delete property '$k' at the same time!\n"
+			if defined($opts->{$k});
 
 		    delete $data->{$k};
 		}
-- 
2.20.1






More information about the pve-devel mailing list