[pve-devel] [PATCH 2/7] add optionnal current param to config api
Dietmar Maurer
dietmar at proxmox.com
Wed Jan 7 08:35:00 CET 2015
On 01/02/2015 03:15 PM, Alexandre Derumier wrote:
> +
> + if(!$param->{current} || (defined($param->{current}) && $param->{current} == 0)) {
> + foreach my $opt (keys $conf->{pending}) {
> + foreach my $opt (PVE::Tools::split_list($conf->{pending}->{delete})) {
> + delete $conf->{$opt} if $conf->{$opt};
> + }
> + next if ref($conf->{pending}->{$opt}); # just to be sure
> + $conf->{$opt} = $conf->{pending}->{$opt};
> + }
> + }
> +
This looks also a bit strange (loop inside loop?).I changed this to:
if (!$param->{current}) {
foreach my $opt (keys $conf->{pending}) {
next if $opt eq 'delete';
my $value = $conf->{pending}->{$opt};
next if ref($value); # just to be sure
$conf->{$opt} = $value;
}
foreach my $opt
(PVE::Tools::split_list($conf->{pending}->{delete})) {
delete $conf->{$opt} if $conf->{$opt};
}
}
More information about the pve-devel
mailing list