[icinga-checkins] icinga.org: icinga2/mfriedrich/config: ConvertConfig: disable debug output, some reformatting of dump

git at icinga.org git at icinga.org
Thu Apr 4 23:17:17 CEST 2013


Module: icinga2
Branch: mfriedrich/config
Commit: 01cd85256287674348088362dd20258386e3e3a1
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=01cd85256287674348088362dd20258386e3e3a1

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Thu Apr  4 23:16:38 2013 +0200

ConvertConfig: disable debug output, some reformatting of dump

---

 contrib/configconvert/Icinga2/Convert.pm        |    8 ++++----
 contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm |    6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/contrib/configconvert/Icinga2/Convert.pm b/contrib/configconvert/Icinga2/Convert.pm
index 8701220..35e129a 100644
--- a/contrib/configconvert/Icinga2/Convert.pm
+++ b/contrib/configconvert/Icinga2/Convert.pm
@@ -507,7 +507,7 @@ sub convert_2x {
         # XXX even if the service object uses templates, we need to figure out its host_name/service_description in order to safely link hosts towards it
         my @host_names = obj_1x_get_service_host_name($cfg_obj_1x, $obj_1x_service);
        
-        print "DEBUG: service @host_names\n";
+        #print "DEBUG: service @host_names\n";
 
         delete($obj_1x_service->{'__HOSTNAME'});
         push @{$obj_1x_service->{'__HOSTNAME'}}, @host_names;
@@ -541,7 +541,7 @@ sub convert_2x {
             # immediately overwrite the correct host_name
             $cfg_obj_2x->{'service'}->{$service_cnt}->{__SERVICE_HOSTNAME} = $service_host_name;
 
-            say Dumper($cfg_obj_2x->{'service'}->{$service_cnt});
+            #say Dumper($cfg_obj_2x->{'service'}->{$service_cnt});
             ####################################################
             # map existing service attributes
             # same:
@@ -912,7 +912,7 @@ sub convert_2x {
             my @sg_members = sort (map { s/^\s+//; s/\s+$//; $_ } split (/,/, $obj_1x_servicegroup->{'members'}) );
             # just some safety for debugging
             if(@sg_members % 2 != 0) {
-                print "DEBUG: servicegroup $obj_1x_servicegroup->{'servicegroup_name'} members list not even: $obj_1x_servicegroup->{'members'} \n";
+                Icinga2::Utils::debug("servicegroup $obj_1x_servicegroup->{'servicegroup_name'} members list not even: $obj_1x_servicegroup->{'members'}");
             }
 
             while (scalar(@sg_members) > 0) {
@@ -920,7 +920,7 @@ sub convert_2x {
                 my $sg_member_service = shift(@sg_members);
                 my $obj_2x_sg_member = obj_get_service_obj_by_host_name_service_description($cfg_obj_2x, $sg_member_host, $sg_member_service);
 
-                print "DEBUG: $sg_member_host,$sg_member_service found.\n";
+                #print "DEBUG: $sg_member_host,$sg_member_service found.\n";
                 push @{$obj_2x_sg_member->{'servicegroups'}}, $obj_1x_servicegroup->{'servicegroup_name'};
             }
         }
diff --git a/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm b/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm
index 02eb91f..ee6f29d 100644
--- a/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm
+++ b/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm
@@ -151,6 +151,7 @@ sub dump_service_2x {
 
 
     dump_config_line("}");
+    dump_config_line("\n");
 }
 
 sub dump_host_2x {
@@ -251,6 +252,7 @@ sub dump_host_2x {
     # host with no services - valid configuration
     if (!defined($host_2x->{'SERVICE'})) {
         dump_config_line("}");
+        dump_config_line("\n");
         return;
     }
 
@@ -338,6 +340,7 @@ sub dump_host_2x {
         dump_config_line("");
     }
     dump_config_line("}");
+    dump_config_line("\n");
 }
 
 sub dump_user_2x {
@@ -365,6 +368,7 @@ sub dump_user_2x {
 
     dump_config_line("");
     dump_config_line("}");
+    dump_config_line("\n");
 }
 
 sub dump_timeperiod_2x {
@@ -379,6 +383,7 @@ sub dump_timeperiod_2x {
     }
     dump_config_line("");
     dump_config_line("}");
+    dump_config_line("\n");
 }
 
 sub dump_group_2x {
@@ -396,6 +401,7 @@ sub dump_group_2x {
     }
     dump_config_line("");
     dump_config_line("}");
+    dump_config_line("\n");
 }
 
 





More information about the icinga-checkins mailing list