[pve-devel] [PATCH 2/7] add optionnal current param to config api
Alexandre DERUMIER
aderumier at odiso.com
Wed Jan 7 08:58:21 CET 2015
Oh yes, sorry, seem better with your code.
(I'm a lot busy today, It's first day of sales in France, so lot of activity on ecommerce websites)
----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>, "aderumier" <aderumier at odiso.com>
Envoyé: Mercredi 7 Janvier 2015 08:35:00
Objet: Re: [pve-devel] [PATCH 2/7] add optionnal current param to config api
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