diff options
Diffstat (limited to 'lib/Iurt/Process.pm')
-rw-r--r-- | lib/Iurt/Process.pm | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/Iurt/Process.pm b/lib/Iurt/Process.pm index 52b0b79..dfecc46 100644 --- a/lib/Iurt/Process.pm +++ b/lib/Iurt/Process.pm @@ -131,7 +131,7 @@ sub fork_to_monitor { } sub handle_command_error { - my ($run, $config, $cache, $log_msg, $comment, $fulloutput, %opt) = @_; + my ($run, $config, $log_msg, $comment, $fulloutput, %opt) = @_; plog('ERROR', $log_msg); if ($opt{log} && $config->{log_url}) { @@ -146,14 +146,9 @@ sub handle_command_error { } if ($opt{mail} && $config->{sendmail} && !$config->{no_mail}{$opt{mail}}) { - if (! ($cache->{warning}{$opt{hash}}{$opt{mail}} % $opt{freq})) { - my $cc = join ',', grep { !$config->{no_mail}{$_} } split ',', $opt{cc}; - sendmail($opt{mail}, $cc, $opt{error} , "$comment\n$out", "Iurt the rebuild bot <$config->{admin}>", $opt{debug_mail}, $config); - } elsif ($config->{admin}) { - sendmail($config->{admin}, '' , $opt{error}, "$comment\n$out", "Iurt the rebuild bot <$config->{admin}>", $opt{debug_mail}, $config); - } + my $cc = join ',', grep { !$config->{no_mail}{$_} } split ',', $opt{cc}; + sendmail($opt{mail}, $cc, $opt{error} , "$comment\n$out", "Iurt the rebuild bot <$config->{admin}>", $opt{debug_mail}, $config); } - $cache->{warning}{$opt{hash}}{$opt{mail}}++; plog('FAIL', $comment); plog('INFO', "--------------- Command failed, full output follows ---------------"); plog('INFO', $fulloutput); @@ -207,20 +202,19 @@ sub generate_comment { } } -=head2 perform_command($command, $run, $config, $cache, %opt) +=head2 perform_command($command, $run, $config, %opt) Run a command and check various running parameters such as log size, timeout... I<$command> the command to run I<$run> current running options I<$config> the configuration -I<$cache> cached values I<%opt> the options for the command run Return true. =cut sub perform_command { - my ($command, $run, $config, $cache, %opt) = @_; + my ($command, $run, $config, %opt) = @_; $opt{timeout} ||= 300; $opt{freq} ||= 24; @@ -336,7 +330,7 @@ sub perform_command { if (!$call_ret || $kill || $err || $opt{error_regexp} && $fulloutput =~ /$opt{error_regexp}/) { my $msg = "ERROR: call_ret=$call_ret kill=$kill err=$err ($opt{error_regexp})"; - handle_command_error($run, $config, $cache, $msg, $comment, $fulloutput, %opt); + handle_command_error($run, $config, $msg, $comment, $fulloutput, %opt); return 0; } 1; |