From: Fabian Holler Date: Mon, 15 Oct 2012 10:06:50 +0000 (+0200) Subject: fixed jenkins liveboot build trigger X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=ba4028c8247713d5acc43b42e526bb315ba07e49;p=profitbricks%2Fjenkins-build-scripts.git fixed jenkins liveboot build trigger --- diff --git a/add_liveboot_request.py b/add_liveboot_request.py index 0773a71..6c39868 100644 --- a/add_liveboot_request.py +++ b/add_liveboot_request.py @@ -66,7 +66,7 @@ def get_deb_pkg_instance_ids(con, deb_package_id): " JOIN deb_package AS dp ON (dpi.deb_package_id = dp.id)" " WHERE dp.id=%s", (deb_package_id,)) result = cur.fetchall() - return tuple([ i[0] for i in result ]) + return tuple([i[0] for i in result]) def duplicate_pkg_list(con, deb_package_list_id): @@ -125,10 +125,13 @@ def insert_liveboot_request(con, owner_uid, package_list_id): result = cur.fetchone() return result[0] + def trigger_jenkins_build(request_id): - urllib2.urlopen("http://jenkins/view/_Tests/job/liveboot/" - "buildWithParameters?token=BuildIt&REQUEST_ID=" + str(REQUEST_ID)).read() - logger.info("Jenkins build triggered") + url = "http://jenkins/view/_Tests/job/liveboot/buildWithParameters?token" + "=BuildIt&REQUEST_ID=" + str(request_id) + urllib2.urlopen(url).read() + logger.info("Jenkins build triggered (%s)" % url) + def add_liveboot_request(deb_pkg_instance_ids): """ Creates a new liveboot request. @@ -170,9 +173,9 @@ def add_liveboot_request(deb_pkg_instance_ids): logger.debug("deb_pkg_instance_id %s included in the liveboot" " request" % deb_pkg_instance_id) else: - logger.debug("deb_pkg_instance_id %s isn't included in the liveboot" - " request because it isn't member of the default package list" - % deb_pkg_instance_id) + logger.debug("deb_pkg_instance_id %s isn't included in the" + " liveboot request. It isn't listed in the default" + " package list" % deb_pkg_instance_id) if def_pkg_list_updated: pkg_list = duplicate_pkg_list(con, def_pkg_list_id) @@ -180,8 +183,8 @@ def add_liveboot_request(deb_pkg_instance_ids): try: jenkins_uid = pwd.getpwnam("jenkins").pw_uid except Exception as e: - logger.warning("User jenkins can't be found, liveboot_request uid is" - " unspecified") + logger.warning("User jenkins can't be found, liveboot_request uid" + " is unspecified") jenkins_uid = None request_id = insert_liveboot_request(con, jenkins_uid, def_pkg_list_id) @@ -196,4 +199,3 @@ def add_liveboot_request(deb_pkg_instance_ids): if __name__ == "__main__": add_liveboot_request(sys.argv[1:]) -