]> granicus.if.org Git - icinga2/commitdiff
Config Conversion: Make ADMIN/USER macros global again (in resource.conf)
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 12 Sep 2013 16:15:37 +0000 (18:15 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 12 Sep 2013 16:41:18 +0000 (18:41 +0200)
refs #4701

tools/configconvert/Icinga2/Convert.pm

index e8eb2d4356853a301e68f4c4b872caac28529fc0..cda42d9f4dbd3bf480c7da12707d3932fdada59a 100644 (file)
@@ -926,18 +926,6 @@ sub convert_notificationcommand {
                     $notification_commands_2x->{$notification_command_type}->{$notification_command} = Icinga2::Utils::escape_str($commands_1x->{$command_1x_key}->{'command_line'});
                     #say Dumper($commands_1x->{$command_1x_key});
 
-                    # detect $USERn$ macros and replace them too XXX - this should be a global macro?
-                    if ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/ ||
-                        $commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/) {
-                        my @global_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/g);
-                        my @admin_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/g);
-                        push @global_macros, @admin_macros;
-
-                        foreach my $macro_name (@global_macros) {
-                            $notification_commands_2x->{$notification_command_type}->{'command_macros'}->{$macro_name} = Icinga2::Utils::escape_str($global_macros_1x->{$macro_name});
-                        }
-                    }
-
                     # flag this 1.x command as being used
                     $commands_1x->{$command_1x_key}->{__I2_CONVERT_NOTIFICATION_COMMAND_USED} = 1;
                 }
@@ -973,18 +961,6 @@ sub convert_eventhandler {
             # save the command line and command name
             $event_commands_2x->{'command_name'} = $event_command;
             $event_commands_2x->{'command_line'} = Icinga2::Utils::escape_str($commands_1x->{$command_1x_key}->{'command_line'});
-
-            # detect $USERn$ macros and replace them too XXX - this should be a global macro?
-            if ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/ ||
-                $commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/) {
-                my @global_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/g);
-                my @admin_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/g);
-                push @global_macros, @admin_macros;
-
-                foreach my $macro_name (@global_macros) {
-                    $event_commands_2x->{'command_macros'}->{$macro_name} = Icinga2::Utils::escape_str($global_macros_1x->{$macro_name});
-                }
-            }
         }
     }
 
@@ -1030,18 +1006,6 @@ sub convert_checkcommand {
             $command_2x->{'check_command_name_1x'} = $real_command_name_1x;
             #Icinga2::Utils::debug("2x Command: $command_2x->{'check_command'}");
 
-            # detect $USERn$ macros and replace them too XXX - this should be a global macro?
-            if ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/ ||
-                $commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/) {
-                my @global_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/g);
-                my @admin_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/g);
-                push @global_macros, @admin_macros;
-
-                foreach my $macro_name (@global_macros) {
-                    $command_2x->{'command_macros'}->{$macro_name} = Icinga2::Utils::escape_str($global_macros_1x->{$macro_name});
-                }
-            }
-
             # save all command args as macros (we'll deal later with them in service definitions)
             my $arg_cnt = 1;
             foreach my $command_arg_1x (@command_args_1x) {