Module: tools Branch: master Commit: 42d96d82701972605d39a683086786b1b35be6bb URL: https://source.winehq.org/git/tools.git/?a=commit;h=42d96d82701972605d39a683...
Author: Francois Gouget fgouget@codeweavers.com Date: Fri Jan 3 11:32:43 2020 +0100
testbot/Janitor: Notify the administrator whenever an error occurs.
Errors are also recorded in the general TestBot log but administrators would normally only read the log when something breaks the TestBot so that they would miss messages about unexpected TestAgentd.exe files for instance. Directly notifying the administrators about such issues makes it more likely that the Janitor script will remain up to date.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/bin/Janitor.pl | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl index 35500e1..9ee5517 100755 --- a/testbot/bin/Janitor.pl +++ b/testbot/bin/Janitor.pl @@ -51,6 +51,7 @@ use WineTestBot::CGI::Sessions; use WineTestBot::RecordGroups; use WineTestBot::Tasks; use WineTestBot::Users; +use WineTestBot::Utils; use WineTestBot::VMs;
@@ -65,10 +66,12 @@ sub Trace(@) LogMsg @_; }
+my @Errors; sub Error(@) { print STDERR "$Name0:error: ", @_ if (!$LogOnly); LogMsg @_; + push @Errors, "error: ". join("", @_); }
@@ -363,3 +366,10 @@ if ($JobPurgeDays != 0) } } } + +if (@Errors) +{ + NotifyAdministrator("Errors occurred during the TestBot cleanup", + "Some errors occurred while cleaning up the TestBot database and directories:\n\n". + join("", @Errors)); +}