]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
fixup
authorHolger Levsen <holger@layer-acht.org>
Fri, 12 Oct 2012 12:27:45 +0000 (14:27 +0200)
committerHolger Levsen <holger@layer-acht.org>
Fri, 12 Oct 2012 12:27:56 +0000 (14:27 +0200)
db_add.py

index 11e5d2338116925807eb7dde71129e3f73cdbb7f..64e56986a43ad6eeac6a3e3144df9ff122d46606 100755 (executable)
--- 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):