From: Holger Levsen Date: Tue, 6 Sep 2011 08:39:57 +0000 (+0200) Subject: handle non-existing build log gracefully and dont delete workspace on failed builds X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=c8cdf865d2ede2f9c09dc7983b0cc0a132b5a387;p=profitbricks%2Fjenkins-build-scripts.git handle non-existing build log gracefully and dont delete workspace on failed builds --- diff --git a/build.py b/build.py index 8281769..ed26703 100755 --- a/build.py +++ b/build.py @@ -214,6 +214,7 @@ def exit_ok(): sys.exit(0) def exit_error(): + atexit.unregister(remove_git_target_workspace) send_email(SMTP_BUILD_ERROR) sys.exit(1) @@ -406,9 +407,12 @@ if __name__ == '__main__': ) if not ret: build_log=os.path.join('../build-area/result/', '%s_%s_amd64.build' % (pkg_name, version)) - fh = open(build_log, 'r') - logger.info('%s' % (fh.read())) - fh.close() + try: + fh = open(build_log, 'r') + logger.info('%s' % (fh.read())) + fh.close() + except: + pass exit_error() else: create_dput_cfg()