From: Holger Levsen Date: Fri, 28 Sep 2012 16:08:47 +0000 (+0200) Subject: drop logger_error(), use logger.error instead X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=b7f599231da7a6e75c86f8589334d6e3ea409caf;p=profitbricks%2Fjenkins-build-scripts.git drop logger_error(), use logger.error instead --- diff --git a/common_code.py b/common_code.py index f2db8db..eeb68d6 100755 --- a/common_code.py +++ b/common_code.py @@ -16,10 +16,6 @@ def logger_init(): logger.setLevel(logging.DEBUG) return logger -def logger_error(msg): - print msg - logger.error(msg) - def exit_ok(): sys.exit(0) diff --git a/db_add.py b/db_add.py index 9b1abe6..0b52411 100755 --- a/db_add.py +++ b/db_add.py @@ -78,7 +78,7 @@ def db_add_package_instance(con, package_id, origin_id, build_result_id, version except psycopg2.DatabaseError as e: # record already exist - this MUST NOT HAPPEN for jenkins builds cur.execute("ROLLBACK TO a") # have to rollback after failed command - logger_error("FAILED: INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_result_id, version, available) VALUES(%s, %s, %s, '%s', 'true') RETURNING id" % (package_id, origin_id, build_result_id, version)) + logger.error("FAILED: INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_result_id, version, available) VALUES(%s, %s, %s, '%s', 'true') RETURNING id" % (package_id, origin_id, build_result_id, version)) exit_error() return cur.fetchone()[0] diff --git a/debian_build.py b/debian_build.py index 0299e2f..a14d980 100755 --- a/debian_build.py +++ b/debian_build.py @@ -212,7 +212,7 @@ if __name__ == '__main__': #if git_helper.git_clone_remote_repository(GIT_REPO_PATH, GIT_TARGET_DIR): # logger.info('git clone was successfull') #else: - # logger_error('git clone was not successfull') + # logger.error('git clone was not successfull') # exit_error() #atexit.register(remove_git_target_workspace) @@ -227,7 +227,7 @@ if __name__ == '__main__': GIT_UPSTREAM_BRANCH ) else: - logger_error('Could not determine GIT_UPSTREAM_BRANCH') + logger.error('Could not determine GIT_UPSTREAM_BRANCH') exit_error() repo = git.repo.Repo() @@ -319,7 +319,7 @@ if __name__ == '__main__': ) ret = parse_changelog.wait() if ret: - logger_error('%s was not successfull, return code was %s ' % (' '.join(cmd), ret)) + logger.error('%s was not successfull, return code was %s ' % (' '.join(cmd), ret)) raise Exception( '%s was not successfull, return code was %s ' % (' '.join(cmd), ret) ) @@ -339,7 +339,7 @@ if __name__ == '__main__': ) ret = grep_dctrl.wait() if ret: - logger_error('%s was not successfull, return code was %s ' % (' '.join(cmd), ret)) + logger.error('%s was not successfull, return code was %s ' % (' '.join(cmd), ret)) raise Exception( '%s was not successfull, return code was %s ' % (' '.join(cmd), ret) ) @@ -361,14 +361,14 @@ if __name__ == '__main__': section = section.strip() logger.info('Package section is %s' % (section)) if section == 'unknown': - logger_error('debian/control sets "section" to unknown. This is not allowed, failing...') + logger.error('debian/control sets "section" to unknown. This is not allowed, failing...') raise Exception('debian/control sets "section" to unknown. This is not allowed, failing...') exit_error() # enforce correct distribution in debian/changelog for master and hotfix branches allowed_production_distros=('stable', 'stable-proposed-updates', 'production', 'production-proposed-updates') if (GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix/')) and not distribution in allowed_production_distros: - logger_error('Distribution %s in debian/changelog not listed in %s' % allowed_production_distros ) + logger.error('Distribution %s in debian/changelog not listed in %s' % allowed_production_distros ) raise Exception( 'Distribution %s in debian/changelog not listed in %s' % allowed_production_distros @@ -498,7 +498,7 @@ if __name__ == '__main__': subprocess.check_call(cmd) # now handle gpb result if ret: - logger_error( + logger.error( 'git-buildpackage returned non-zero. exitcode was: %s' % ret ) exit_error() @@ -528,13 +528,13 @@ if __name__ == '__main__': try: subprocess.check_call(cmd) except: - logger_error('Could not tag repository with "%s".' % version_tag) + logger.error('Could not tag repository with "%s".' % version_tag) exit_error() cmd = ['/usr/bin/git', 'push', 'origin', version_tag] try: subprocess.check_call(cmd) except: - logger_error('Could not push tag "%s" to repository.' % version_tag) + logger.error('Could not push tag "%s" to repository.' % version_tag) exit_error() logger.info('Tagged as "%s".' % version_tag) @@ -566,9 +566,6 @@ if __name__ == '__main__': subprocess.check_call(cmd) logger.exception(error) exit_error() - logger.info('---------------------------------------------------------------------------------------------------------') - cmd = ['figlet-figlet', '-t', 'Success!!!'] - subprocess.check_call(cmd) BUILD_END = datetime.datetime.now() # FIXME: must not add development builds... or maybe? # cidb wise, we only care about builds from master, hotfix + develop @@ -579,7 +576,7 @@ if __name__ == '__main__': except Exception, error: cmd = ['figlet-figlet', '-t', 'CIDB problem:'] subprocess.check_call(cmd) - logger_error("package instance not added to DB") + logger.error("package instance not added to DB") exit_error() if len(package_instances) > 0: try: @@ -587,5 +584,8 @@ if __name__ == '__main__': except: logger.debug("liveboot request failed") # finally + logger.info('---------------------------------------------------------------------------------------------------------') + cmd = ['figlet-figlet', '-t', 'Success!!!'] + subprocess.check_call(cmd) exit_ok()