This commit is contained in:
garnier-quentin 2020-07-02 10:41:03 +02:00
parent 547cf2115f
commit f0e668fb10
1 changed files with 13 additions and 12 deletions

View File

@ -350,22 +350,23 @@ sub manage_selection {
} }
if (defined($self->{option_results}->{filter_duplicate})) { if (defined($self->{option_results}->{filter_duplicate})) {
my $sid = $_; my $duplicate = 0;
my @duplicate = grep { foreach my $entry (values %{$self->{storage}}) {
($self->{storage}->{$_}->{allocation_units} == $result->{$oid_hrStorageAllocationUnits . "." . $sid}) && if (($entry->{allocation_units} == $result->{$oid_hrStorageAllocationUnits . '.' . $_}) &&
($self->{storage}->{$_}->{size} == $result->{$oid_hrStorageSize . "." . $sid}) && ($entry->{size} == $result->{$oid_hrStorageSize . "." . $_}) &&
($self->{storage}->{$_}->{used} == $result->{$oid_hrStorageUsed . "." . $sid}) ($entry->{used} == $result->{$oid_hrStorageUsed . "." . $_})) {
} keys $self->{storage}; $duplicate = 1;
if (scalar(@duplicate)) { last;
next; }
} }
next if ($duplicate == 1);
} }
$self->{storage}->{$_} = { $self->{storage}->{$_} = {
display => $name_storage, display => $name_storage,
allocation_units => $result->{$oid_hrStorageAllocationUnits . "." . $_}, allocation_units => $result->{$oid_hrStorageAllocationUnits . '.' . $_},
size => $result->{$oid_hrStorageSize . "." . $_}, size => $result->{$oid_hrStorageSize . '.' . $_},
used => $result->{$oid_hrStorageUsed . "." . $_}, used => $result->{$oid_hrStorageUsed . '.' . $_},
access => defined($access_result->{$_}) ? $access_result->{$_} : undef, access => defined($access_result->{$_}) ? $access_result->{$_} : undef,
}; };
$self->{global}->{count}++; $self->{global}->{count}++;