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 --- testbot/bin/Janitor.pl | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl index 35500e1f0..9ee5517fc 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)); +}