Changeset 76625 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Jan 3, 2019 5:24:36 PM (6 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py
r76553 r76625 367 367 return rcExit; 368 368 369 def emailAlert(self, uidAuthor, sBodyText): 370 asEmailList = []; 369 def sendEmailAlert(self, uidAuthor, sBodyText): 370 """ 371 Sends email alert. 372 """ 371 373 372 374 # Get author email … … 378 380 sFrom = g_ksAlertFrom; 379 381 382 # Gather recipient list. 383 asEmailList = []; 380 384 for sUser in g_asAlertList: 381 385 self.oDb.execute('SELECT sEmail FROM Users WHERE sUsername=%s', (sUser,)); 382 386 sEmail = self.oDb.fetchOne(); 383 if sEmail is None: 384 # No address to send an alert. 385 return; 386 asEmailList.append(sEmail[0]); 387 387 if sEmail: 388 asEmailList.append(sEmail[0]); 389 if not asEmailList: 390 return self.eprint('No email addresses to send alter to!'); 391 392 # Compose the message. 388 393 oMsg = MIMEMultipart(); 389 394 oMsg['From'] = sFrom; … … 392 397 oMsg.attach(MIMEText(sBodyText, 'plain')) 393 398 399 # Try send it. 394 400 try: 395 401 oSMTP = smtplib.SMTP(g_ksSmtpHost, g_kcSmtpPort); … … 397 403 oSMTP.quit() 398 404 except smtplib.SMTPException as oXcpt: 399 rcExit = self.eprint('Failed to send mail: %s' % (oXcpt,)); 400 401 return rcExit; 402 405 return self.eprint('Failed to send mail: %s' % (oXcpt,)); 406 407 return 0; 403 408 404 409 def badTestBoxManagement(self): … … 529 534 sComment = u'Reset testbox #%u (%s) - iRC=%u sStduot=%s' % ( idTestBox, oTestBox.sName, iRC, sStdout); 530 535 self.vprint(sComment); 531 self. emailAlert(self.uidSelf, sComment);536 self.sendEmailAlert(self.uidSelf, sComment); 532 537 533 538 except Exception as oXcpt: -
trunk/src/VBox/ValidationKit/testmanager/config.py
r76553 r76625 194 194 g_kcSmtpPort = 25; 195 195 ## Default email 'From' for email alert. 196 g_ksAlertFrom = 'vs [email protected]';196 g_ksAlertFrom = 'vsh[email protected]'; 197 197 ## Subject for email alert. 198 g_ksAlertSubject = 'Virtual Sheriff alert';198 g_ksAlertSubject = 'Virtual Test Sheriff Alert'; 199 199 ## List of users to send alerts. 200 200 g_asAlertList = ['lelik', 'werner'];
Note:
See TracChangeset
for help on using the changeset viewer.