From 3f79e8da6314d22eacc3d2a186d66b0cde97c0a2 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 9 Nov 2011 15:07:29 +0100 Subject: [PATCH] remove funtionality to send mail. let jenkins handle this. --- debian_build.py | 28 ---------------------------- kernel_build.py | 24 ------------------------ kernel_inpbuilder.py | 1 - 3 files changed, 53 deletions(-) diff --git a/debian_build.py b/debian_build.py index 30f1e8b..e1e595a 100755 --- a/debian_build.py +++ b/debian_build.py @@ -10,7 +10,6 @@ import errno import atexit import shutil import logging -import smtplib import optparse import datetime import platform @@ -73,15 +72,6 @@ GIT_TARGET_DIR = os.path.join( JOB_NAME = os.environ.get('JOB_NAME') GIT_COMMITTER_EMAIL = os.environ.get('GIT_COMMITTER_EMAIL') -SMTP_SERVER = 'roma.profitbricks.localdomain' -SMTP_SUBJECT = 'Build for job %s, branch %s, buildnumber %s was %s' -SMTP_TEXT = ( - 'Build for job %s, branch %s, buildnumber %s was %s. ' + - 'Take a close look at: ' + BUILD_URL -) -SMTP_BUILD_SUCCESS = 'SUCCESSFUL' -SMTP_BUILD_ERROR = 'NOT SUCCESSFUL' -SMTP_FROM = '%s@profitbricks.com' %(pwd.getpwuid(os.geteuid()).pw_name) DPUT_OPTIONS = { 'fqdn': 'alexandria.profitbricks.localdomain', @@ -118,22 +108,6 @@ def logger_loud_error(msg): print '##########################################################################' print '##########################################################################' -def send_email(result): - smtp = smtplib.SMTP(SMTP_SERVER) - if result == SMTP_BUILD_ERROR: - global SMTP_TEXT - SMTP_TEXT += '\nThe filesystem path is: %s' %(GIT_TARGET_WORKSPACE) - msg = ( - 'From: %s\n' %(SMTP_FROM) + - 'To: %s\n' %(GIT_COMMITTER_EMAIL) + - 'Subject: %s\n' %(SMTP_SUBJECT %(JOB_NAME, GIT_DEBIAN_BRANCH, BUILD_NUMBER, - result)) + - '%s\n' %(SMTP_TEXT %(JOB_NAME, GIT_DEBIAN_BRANCH, BUILD_NUMBER, result)) - ) - logger.info('Sending this message: %s', msg) - smtp.sendmail(SMTP_FROM, GIT_COMMITTER_EMAIL, msg) - smtp.quit() - def read_file(path): try: fh = open(path, 'r', 1) @@ -225,12 +199,10 @@ def remove_git_target_workspace(): def exit_ok(): - send_email(SMTP_BUILD_SUCCESS) sys.exit(0) def exit_error(): sys.exitfunc = lambda: None - send_email(SMTP_BUILD_ERROR) sys.exit(1) def getopts(): diff --git a/kernel_build.py b/kernel_build.py index 2a3b55f..f21f274 100644 --- a/kernel_build.py +++ b/kernel_build.py @@ -8,7 +8,6 @@ import atexit import shutil import subprocess import logging -import smtplib from glob import glob from logging import Formatter import kernel_persistence @@ -27,15 +26,6 @@ GIT_BRANCH_NAME = os.environ.get('GIT_BRANCH_NAME') GIT_COMMITTER_EMAIL = os.environ.get('GIT_COMMITTER_EMAIL') -SMTP_SERVER = 'roma.profitbricks.localdomain' -SMTP_SUBJECT = 'Kernel build for branch %s, buildnumber %s was %s' -SMTP_TEXT = ( - 'Kernel build for branch %s, buildnumber %s was %s. ' + - 'Take a close look at: ' + BUILD_URL -) -SMTP_BUILD_SUCCESS = 'SUCCESSFUL' -SMTP_BUILD_ERROR = 'NOT SUCCESSFUL' -SMTP_FROM = 'jenkins@profitbricks.com' PBUILDER = '/usr/sbin/pbuilder' SUDO = '/usr/bin/sudo' @@ -55,18 +45,6 @@ stream_handler.setFormatter(formatter) logger.addHandler(stream_handler) -def send_email(result): - smtp = smtplib.SMTP(SMTP_SERVER) - msg = ( - 'From: %s\n' %(SMTP_FROM) + - 'To: %s\n' %(GIT_COMMITTER_EMAIL) + - 'Subject: %s\n' %(SMTP_SUBJECT %(GIT_BRANCH_NAME, BUILD_NUMBER, - result)) + - '%s\n' %(SMTP_TEXT %(GIT_BRANCH_NAME, BUILD_NUMBER, result)) - ) - smtp.sendmail(SMTP_FROM, GIT_COMMITTER_EMAIL, msg) - smtp.quit() - def build_kernel_with_pbuilder(revision, pbuilder_script, dist='stable'): pbuilder_script = os.path.abspath(pbuilder_script) @@ -131,11 +109,9 @@ def remove_git_target_workspace(): logger.info('deleted %s' %(rmpath)) def exit_ok(): - send_email(SMTP_BUILD_SUCCESS) sys.exit(0) def exit_error(): - send_email(SMTP_BUILD_ERROR) sys.exit(1) if __name__ == '__main__': diff --git a/kernel_inpbuilder.py b/kernel_inpbuilder.py index 3e9434e..75face2 100644 --- a/kernel_inpbuilder.py +++ b/kernel_inpbuilder.py @@ -9,7 +9,6 @@ import shutil import subprocess import logging import platform -import smtplib import optparse from glob import glob from logging import Formatter -- 2.39.5