configconvert: only export servicegroups when available

refs #2743
This commit is contained in:
Michael Friedrich 2013-06-25 13:16:10 +02:00
parent 97dd38051e
commit 8eccb97642
1 changed files with 5 additions and 2 deletions

View File

@ -304,13 +304,16 @@ sub dump_service_2x {
####################################################
# servicegroups
####################################################
if(defined($service_2x->{'servicegroups'})) {
if(defined($service_2x->{'servicegroups'}) && scalar(@{$service_2x->{'servicegroups'}}) > 0) {
#say Dumper($service_2x->{'servicegroups'});
my $servicegroups = join '", "', @{$service_2x->{'servicegroups'}};
if ($service_2x->{'__I2_CONVERT_SG_ADD'} == 1) {
dump_config_line($icinga2_cfg, "\tservicegroups += [ \"$servicegroups\" ],");
} else {
dump_config_line($icinga2_cfg, "\tservicegroups = [ \"$servicegroups\" ],");
}
#say Dumper($service_description);
#say Dumper($service_2x->{'servicegroups'});
}
####################################################
@ -624,7 +627,7 @@ sub dump_host_2x {
####################################################
# servicegroups
####################################################
if(defined($service_2x->{'servicegroups'})) {
if(defined($service_2x->{'servicegroups'}) && scalar(@{$service_2x->{'servicegroups'}}) > 0) {
#say Dumper($service_2x->{'servicegroups'});
my $servicegroups = join '", "', @{$service_2x->{'servicegroups'}};
if ($service_2x->{'__I2_CONVERT_SG_ADD'} == 1) {