]> git.proxmox.com Git - pve-network.git/commitdiff
api: handle delete parameter when updating ipams
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 22 Nov 2023 10:49:20 +0000 (11:49 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 22 Nov 2023 11:29:07 +0000 (12:29 +0100)
this is for completeness, currently no plugin has optional
properties...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/API2/Network/SDN/Ipams.pm

index d6e0bc8c99c68eb88f31e2533c2c1443ff7ec533..27ead025256eb0ab1aa2e8c83d689553f5fac4ad 100644 (file)
@@ -180,6 +180,7 @@ __PACKAGE__->register_method ({
 
        my $id = extract_param($param, 'ipam');
        my $digest = extract_param($param, 'digest');
+       my $delete = extract_param($param, 'delete');
 
         PVE::Network::SDN::lock_sdn_config(
         sub {
@@ -193,6 +194,12 @@ __PACKAGE__->register_method ({
            my $plugin = PVE::Network::SDN::Ipams::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};
            }