[icinga-checkins] icinga.org: icinga2/mfriedrich/config: ConfigConvert: fix hash keys for convert/dump in perl 5.14

git at icinga.org git at icinga.org
Wed Apr 3 19:10:50 CEST 2013


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

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Wed Apr  3 10:10:25 2013 +0200

ConfigConvert: fix hash keys for convert/dump in perl 5.14

---

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

diff --git a/contrib/configconvert/Icinga2/Convert.pm b/contrib/configconvert/Icinga2/Convert.pm
index 18af0d1..2f3af4c 100644
--- a/contrib/configconvert/Icinga2/Convert.pm
+++ b/contrib/configconvert/Icinga2/Convert.pm
@@ -481,7 +481,7 @@ sub convert_2x {
         }
     }
 
-    foreach my $host_2x_key (keys @$cfg_obj_v2{'host'}) {
+    foreach my $host_2x_key (keys %{@$cfg_obj_v2{'host'}}) {
         my $host_2x = @$cfg_obj_v2{'host'}->{$host_2x_key};
         #say Dumper($host_2x);
         #say "==============\n";
diff --git a/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm b/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm
index 1eee3d0..63f5759 100644
--- a/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm
+++ b/contrib/configconvert/Icinga2/DumpIcinga2Cfg.pm
@@ -73,8 +73,10 @@ sub dump_host_2x {
     # host with no services - valid configuration
     return if !defined($host_2x->{'SERVICE'});
 
+    #say Dumper($host_2x->{'SERVICE'});
+
     # now all services with templates
-    foreach my $service_2x_key (keys $host_2x->{'SERVICE'}) {
+    foreach my $service_2x_key (keys %{$host_2x->{'SERVICE'}}) {
         my $service_2x = $host_2x->{'SERVICE'}->{$service_2x_key};
 
         dump_config_line("\tservices[\"$service_2x->{'service_description'}\"] = {");
@@ -82,7 +84,7 @@ sub dump_host_2x {
         dump_config_line("");
         dump_config_line("\t\tmacros = {");
         if(defined($service_2x->{'command_macros'}) && $service_2x->{'command_macros'} != 0) {
-            foreach my $cmd_arg (keys $service_2x->{'command_macros'}) {
+            foreach my $cmd_arg (keys %{$service_2x->{'command_macros'}}) {
                 dump_config_line("\t\t\t$cmd_arg = \"$service_2x->{'command_macros'}->{$cmd_arg}\",");
             }
         }





More information about the icinga-checkins mailing list