Title: [opsview] [10169] remove duplicated matpaths
- Revision
- 10169
- Author
- aburzynski
- Date
- 2012-09-25 17:12:32 +0100 (Tue, 25 Sep 2012)
Log Message
remove duplicated matpaths
Modified Paths
Modified: trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm
===================================================================
--- trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm 2012-09-25 16:11:46 UTC (rev 10168)
+++ trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm 2012-09-25 16:12:32 UTC (rev 10169)
@@ -11,6 +11,7 @@
use Opsview::Utils
qw(convert_to_arrayref convert_state_to_text convert_host_state_to_text convert_state_type_to_text set_highest_service_state get_first_hash_key);
+use List::MoreUtils qw( uniq );
use base qw/Runtime::ResultSet/;
@@ -49,6 +50,7 @@
if ( exists $filters->{fromhostname} ) {
my $hostnames = convert_to_arrayref( $filters->{fromhostname} );
my @matpaths =
+ map { $_->{matpath} . "%" }
$self->result_source->schema->resultset("OpsviewHosts")->search(
{ "me.name" => $hostnames },
{
@@ -59,11 +61,8 @@
}
)->all;
$self = $self->search(
- {
- 'matpaths.matpath' =>
- { '-like' => [ map { $_->{matpath} . "%" } @matpaths ] }
- },
- { join => { host => 'matpaths' } }
+ { 'matpaths.matpath' => { '-like' => [ uniq(@matpaths) ] } },
+ { join => { host => 'matpaths' } }
);
$num_filters++;
}
_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins