]> granicus.if.org Git - icinga2/commitdiff
configconvert: only export servicegroups when available
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 25 Jun 2013 11:16:10 +0000 (13:16 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 26 Jun 2013 07:23:01 +0000 (09:23 +0200)
refs #2743

tools/configconvert/Icinga2/ExportIcinga2Cfg.pm

index a15490d7005b3038de2119dae790f576d045b94a..cc5cf8c6957036ff2e3ca84ff176f7e9943cb4c2 100644 (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) {