Skip to content

Commit

Permalink
Correct logging of bad robot to permit rerouting with ErrorDestination,
Browse files Browse the repository at this point in the history
and to remove duplicate log message.
  • Loading branch information
Josh Lavin committed Jul 10, 2014
1 parent 2b7e29d commit ca82c6e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/Vend/Error.pm
Expand Up @@ -186,25 +186,19 @@ sub do_lockout {
# Now we log the error after custom lockout routine gets chance
# to bypass
my $pause = $::Limit->{lockout_reset_seconds} || 30;
$msg = errmsg(
"WARNING: POSSIBLE BAD ROBOT. %s accesses with no %d second pause.",
$Vend::Session->{accesses},
$pause,
);
::logError($msg);
my $msg_string = "WARNING: POSSIBLE BAD ROBOT. %s accesses with no %d second pause.";
::logError($msg_string, $Vend::Session->{accesses}, $pause);

if($cmd = $Global::LockoutCommand) {
my $host = $CGI::remote_addr;
$cmd =~ s/%s/$host/ or $cmd .= " $host";
$msg .= errmsg("Performing lockout command '%s'", $cmd);
system $cmd;
$msg .= errmsg("\nBad status %s from '%s': %s\n", $?, $cmd, $!)
if $?;
$? and $msg .= "\n" . errmsg("Bad status %s from '%s': %s\n", $?, $cmd, $!);
logGlobal({level => 'notice'}, $msg);
}
$Vend::Cfg->{VendURL} = $Vend::Cfg->{SecureURL} = 'http://127.0.0.1';
$Vend::LockedOut = 1;
logError($msg) if $msg;
return;
}

Expand Down

0 comments on commit ca82c6e

Please sign in to comment.