con.commit()
return db_package_instance_id
-def db_add_requested_liveboot_build (con, request_id, build_id):
- cur = con.cursor()
- cur.execute("SAVEPOINT a")
- try:
- cur.execute("INSERT INTO liveboot_request_jenkins_build(liveboot_request_id, jenkins_build_id) VALUES(%s, %s) RETURNING id" % (request_id, build_id))
- con.commit()
- except psycopg2.DatabaseError as e:
- cur.execute("ROLLBACK TO a") # have to rollback after failed command
- #logger.debug("INSERT INTO jenkins_build(jenkins_build_number, jenkins_job_id) VALUES(%s, %s) RETURNING id" % (number, db_id))
- return cur.fetchone()[0]
-
def get_package_instance(origin, package, version):
con = db_connect()
cur = con.cursor()
con = db_connect()
db_job_id = db_add_job(con, job_name)
db_build_id = db_add_build(con, db_job_id, build_number, start, 'NULL', 'in progress')
- db_add_requested_liveboot_build(con, request_id, db_build_id)
con.commit()
logger.info("CIDB init for liveboot OK.")
return