[pve-devel] [PATCH network 6/7] api: handle delete parameter when updating dns entries

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Nov 22 12:53:49 CET 2023


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/PVE/API2/Network/SDN/Dns.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/API2/Network/SDN/Dns.pm b/src/PVE/API2/Network/SDN/Dns.pm
index 3d08552..826d111 100644
--- a/src/PVE/API2/Network/SDN/Dns.pm
+++ b/src/PVE/API2/Network/SDN/Dns.pm
@@ -173,6 +173,7 @@ __PACKAGE__->register_method ({
 
 	my $id = extract_param($param, 'dns');
 	my $digest = extract_param($param, 'digest');
+	my $delete = extract_param($param, 'delete');
 
         PVE::Network::SDN::lock_sdn_config(
 	 sub {
@@ -186,6 +187,12 @@ __PACKAGE__->register_method ({
 	    my $plugin = PVE::Network::SDN::Dns::Plugin->lookup($scfg->{type});
 	    my $opts = $plugin->check_config($id, $param, 0, 1);
 
+	    if ($delete) {
+		$delete = [ PVE::Tools::split_list($delete) ];
+		my $options = $plugin->private()->{options}->{$scfg->{type}};
+		PVE::SectionConfig::delete_from_config($scfg, $options, $opts, $delete);
+	    }
+
 	    foreach my $k (%$opts) {
 		$scfg->{$k} = $opts->{$k};
 	    }
-- 
2.39.2






More information about the pve-devel mailing list