From: Holger Levsen Date: Fri, 12 Oct 2012 12:27:45 +0000 (+0200) Subject: fixup X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=6458cc30bc221022a828850f68bb1db246a98565;p=profitbricks%2Fjenkins-build-scripts.git fixup --- diff --git a/db_add.py b/db_add.py index 11e5d23..64e5698 100755 --- a/db_add.py +++ b/db_add.py @@ -26,16 +26,17 @@ def db_add_job(con, name): cur.execute("ROLLBACK TO a") # have to rollback after failed command cur.execute("SELECT id FROM jenkins_job WHERE name='%s'" % (name)) #logger.debug("INSERT INTO jenkins_job(name) VALUES('%s')" % (name)) + con.commit() return cur.fetchone()[0] def db_add_build(con, db_id, number, start, end, status): cur = con.cursor() cur.execute("SAVEPOINT a") try: - cur.execute("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, '%s', '%s', '%s') RETURNING id" % (db_id, number, start, end, status)) + cur.execute("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, to_timestamp('%s'), to_timestamp('%s'), '%s') RETURNING id" % (db_id, number, start, end, status)) except psycopg2.DatabaseError as e: cur.execute("ROLLBACK TO a") # have to rollback after failed command - logger.debug("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, '%s', '%s', '%s') RETURNING id" % (db_id, number, start, end, status)) + logger.debug("INSERT INTO jenkins_build(jenkins_job_id, jenkins_build_number, build_start, build_end, status) VALUES(%s, %s, to_timestamp('%s'), to_timestamp('%s'), '%s') RETURNING id" % (db_id, number, start, end, status)) return cur.fetchone()[0] def db_update_build(con, db_id, end, status):