return(True and result)
-def add_liveboot_request(con, owner_uid, package_list_id):
+def insert_liveboot_request(con, owner_uid, package_list_id):
cur = con.cursor()
cur.execute("INSERT INTO liveboot_request(owner_uid, package_list_id)"
" VALUES(%s)", (owner_uid, package_list_id))
-
-if __name__ == "__main__":
- if len(sys.argv) != 2:
- print("usage: %s deb_package_instance_id")
- sys.exit(1)
- deb_pkg_instance_id = int(sys.argv[1])
-
+def add_liveboot_request(deb_pkg_instance_id):
logging.basicConfig()
logger = logging.getLogger()
# If the package is included in the default package list, update the list
# to include newest version of the package
deb_pkg_id = get_deb_pkg_id(con, deb_pkg_instance_id)
- if not deb_pkg_id:
- sys.exit(1)
-
def_pkg_list_id = get_default_pkg_list(con)
- if not def_pkg_list_id:
- sys.exit(1)
# This can't return None with the used db constraints
deb_pkg_instance_ids = get_deb_pkg_instance_ids(con, deb_pkg_id)
if not updated:
logger.info("deb_package with id %s doesn't exist in default package"
" list, no liveboot request will be created")
- sys.exit(0)
-
- # create a new liveboot request with the updated default package list
- jenkins_uid = pwd.getpwnam("jenkins").pw_uid
- add_liveboot_request(con, jenkins_uid, def_pkg_list_id)
- con.commit()
- sys.exit(0)
+ else:
+ # create a new liveboot request with the updated default package list
+ jenkins_uid = pwd.getpwnam("jenkins").pw_uid
+ insert_liveboot_request(con, jenkins_uid, def_pkg_list_id)
+ con.commit()
+ return