mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 08:04:14 +02:00
configconvert: fix 'n' and 'a' notification_options (filter = 0, filter = ...)
refs #4060
This commit is contained in:
parent
1faba25e9c
commit
18e3bdc581
@ -749,11 +749,13 @@ sub convert_notification_options_to_filter {
|
|||||||
|
|
||||||
# verify if there's 'n' (none) or 'a' (all) and ignore the rest then
|
# verify if there's 'n' (none) or 'a' (all) and ignore the rest then
|
||||||
if (grep /n/, @options) {
|
if (grep /n/, @options) {
|
||||||
|
push @{$filter->{'state'}}, 0;
|
||||||
|
push @{$filter->{'type'}}, 0;
|
||||||
return $filter;
|
return $filter;
|
||||||
}
|
}
|
||||||
if (grep /a/, @options) {
|
if (grep /a/, @options) {
|
||||||
foreach my $by (keys %{$filter_by}) {
|
foreach my $by (keys %{$filter_by}) {
|
||||||
push @{$filter->{$by}}, $filter_names->{$by};
|
push @{$filter->{$filter_by->{$by}}}, $filter_names->{$by};
|
||||||
}
|
}
|
||||||
return $filter;
|
return $filter;
|
||||||
}
|
}
|
||||||
|
@ -392,8 +392,13 @@ sub dump_service_2x {
|
|||||||
#say Dumper($service_2x);
|
#say Dumper($service_2x);
|
||||||
foreach my $by (keys %{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
foreach my $by (keys %{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
||||||
next if !@{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
next if !@{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
||||||
my $notification_filter = "notification_".$by."_filter = (". (join ' | ', @{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
my $notification_filter;
|
||||||
dump_config_line($icinga2_cfg, "\t$notification_filter,");
|
if (grep /0/, @{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) {
|
||||||
|
$notification_filter = 0;
|
||||||
|
} else {
|
||||||
|
$notification_filter = "(". (join ' | ', @{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
||||||
|
}
|
||||||
|
dump_config_line($icinga2_cfg, "\tnotification_".$by."_filter = $notification_filter,");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,8 +521,13 @@ sub dump_host_2x {
|
|||||||
if(defined($host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'})) {
|
if(defined($host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'})) {
|
||||||
foreach my $by (keys %{$host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
foreach my $by (keys %{$host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
||||||
next if !@{$host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
next if !@{$host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
||||||
my $notification_filter = "notification_".$by."_filter = (". (join ' | ', @{$host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
my $notification_filter;
|
||||||
dump_config_line($icinga2_cfg, "\t$notification_filter,");
|
if (grep /0/, @{$host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) {
|
||||||
|
$notification_filter = 0;
|
||||||
|
} else {
|
||||||
|
$notification_filter = "(". (join ' | ', @{$host_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
||||||
|
}
|
||||||
|
dump_config_line($icinga2_cfg, "\tnotification_".$by."_filter = $notification_filter,");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,8 +680,13 @@ sub dump_host_2x {
|
|||||||
if(defined($service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'})) {
|
if(defined($service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'})) {
|
||||||
foreach my $by (keys %{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
foreach my $by (keys %{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
||||||
next if !@{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
next if !@{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
||||||
my $notification_filter = "notification_".$by."_filter = (". (join ' | ', @{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
my $notification_filter;
|
||||||
dump_config_line($icinga2_cfg, "\t$notification_filter,");
|
if (grep /0/, @{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) {
|
||||||
|
$notification_filter = 0;
|
||||||
|
} else {
|
||||||
|
$notification_filter = "(". (join ' | ', @{$service_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
||||||
|
}
|
||||||
|
dump_config_line($icinga2_cfg, "\tnotification_".$by."_filter = $notification_filter,");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,8 +832,13 @@ sub dump_user_2x {
|
|||||||
if(defined($user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'})) {
|
if(defined($user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'})) {
|
||||||
foreach my $by (keys %{$user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
foreach my $by (keys %{$user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}}) {
|
||||||
next if !@{$user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
next if !@{$user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}};
|
||||||
my $notification_filter = "notification_".$by."_filter = (". (join ' | ', @{$user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
my $notification_filter;
|
||||||
dump_config_line($icinga2_cfg, "\t$notification_filter,");
|
if (grep /0/, @{$user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) {
|
||||||
|
$notification_filter = 0;
|
||||||
|
} else {
|
||||||
|
$notification_filter = "(". (join ' | ', @{$user_2x->{'__I2CONVERT_NOTIFICATION_FILTERS'}->{$by}}) .")";
|
||||||
|
}
|
||||||
|
dump_config_line($icinga2_cfg, "\tnotification_".$by."_filter = $notification_filter,");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user