[5/5] testbot/RevertVM: Only send an email if the VM has been marked as offline.
Francois Gouget
fgouget at codeweavers.com
Wed Oct 24 05:16:42 CDT 2012
---
testbot/bin/RevertVM.pl | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/RevertVM.pl b/testbot/bin/RevertVM.pl
index 743760f..ee46218 100755
--- a/testbot/bin/RevertVM.pl
+++ b/testbot/bin/RevertVM.pl
@@ -39,25 +39,29 @@ sub FatalError
{
my ($ErrMessage, $VM) = @_;
- my $VMKey = defined($VM) ? $VM->GetKey() : "";
-
LogMsg $ErrMessage, "\n";
if ($VM)
{
$VM->Status("offline");
$VM->Save();
- }
- open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq");
- print SENDMAIL <<"EOF";
+ my $VMKey = $VM->GetKey();
+ my $VMSnapshot = $VM->IdleSnapshot;
+ open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq");
+ print SENDMAIL <<"EOF";
From: <$RobotEMail> (Marvin)
To: $AdminEMail
Subject: VM $VMKey offline
-Reverting $VMKey resulted in error "$ErrMessage". The VM has been put offline.
+Reverting $VMKey to $VMSnapshot failed:
+
+$ErrMessage
+
+The VM has been put offline.
EOF
- close(SENDMAIL);
+ close(SENDMAIL);
+ }
exit 1;
}
--
1.7.10.4
More information about the wine-patches
mailing list