From c9497367d2e56d9b2bc958ce93d326d9f8c7ee21 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 12 Sep 2013 18:15:37 +0200 Subject: [PATCH] Config Conversion: Make ADMIN/USER macros global again (in resource.conf) refs #4701 --- tools/configconvert/Icinga2/Convert.pm | 36 -------------------------- 1 file changed, 36 deletions(-) diff --git a/tools/configconvert/Icinga2/Convert.pm b/tools/configconvert/Icinga2/Convert.pm index e8eb2d435..cda42d9f4 100644 --- a/tools/configconvert/Icinga2/Convert.pm +++ b/tools/configconvert/Icinga2/Convert.pm @@ -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) { -- 2.40.0