Francois Gouget : testbot/RevertVM: Only send an email if the VM has been marked as offline.

Alexandre Julliard julliard at winehq.org
Wed Oct 24 13:21:02 CDT 2012


Module: tools
Branch: master
Commit: 1f9f5654928f20791b023ecf75a0f3d71b2724a2
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=1f9f5654928f20791b023ecf75a0f3d71b2724a2

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Oct 24 12:16:42 2012 +0200

testbot/RevertVM: Only send an email if the VM has been marked as offline.

---

 testbot/bin/RevertVM.pl |   18 +++++++++++-------
 1 files 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;
 }




More information about the wine-cvs mailing list