mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-07 16:47:46 +00:00
implement delete parameter for replicationconfig
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
c9a8015d95
commit
dc9bc76843
@ -160,6 +160,7 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
my $id = extract_param($param, 'id');
|
my $id = extract_param($param, 'id');
|
||||||
my $digest = extract_param($param, 'digest');
|
my $digest = extract_param($param, 'digest');
|
||||||
|
my $delete = extract_param($param, 'delete');
|
||||||
|
|
||||||
my $code = sub {
|
my $code = sub {
|
||||||
my $cfg = PVE::ReplicationConfig->new();
|
my $cfg = PVE::ReplicationConfig->new();
|
||||||
@ -176,6 +177,19 @@ __PACKAGE__->register_method ({
|
|||||||
$data->{$k} = $opts->{$k};
|
$data->{$k} = $opts->{$k};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($delete) {
|
||||||
|
my $options = $plugin->private()->{options}->{$data->{type}};
|
||||||
|
foreach my $k (PVE::Tools::split_list($delete)) {
|
||||||
|
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};
|
||||||
|
delete $data->{$k};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$cfg->write();
|
$cfg->write();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user