From 0aceb54e2644e3d2ad8d48d042bdff714257bb72 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 12 Oct 2012 12:07:47 +0200 Subject: [PATCH] fixup: successful is the new true --- db_add.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db_add.py b/db_add.py index 3470352..38f2d04 100755 --- a/db_add.py +++ b/db_add.py @@ -32,10 +32,10 @@ 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, '%s', '%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.info("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.info("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)) return cur.fetchone()[0] def db_add_origin(con, origin): @@ -66,11 +66,11 @@ def db_add_package_instance(con, package_id, origin_id, build_id, version): cur = con.cursor() cur.execute("SAVEPOINT a") try: - cur.execute("INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_id, version, available) VALUES(%s, %s, %s, '%s', 'successful') RETURNING id" % (package_id, origin_id, build_id, version)) + cur.execute("INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_id, version, available) VALUES(%s, %s, %s, '%s', true) RETURNING id" % (package_id, origin_id, build_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_id, version, available) VALUES(%s, %s, %s, '%s', 'successful') RETURNING id" % (package_id, origin_id, build_id, version)) + logger.error("FAILED: INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_id, version, available) VALUES(%s, %s, %s, '%s', true) RETURNING id" % (package_id, origin_id, build_id, version)) exit_error() return cur.fetchone()[0] -- 2.39.5