From 54793f572420053b48e156a20e8784d9504118c0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 08 2016 17:30:39 +0000 Subject: Ensure that we are calling the proper ci_hook object By default SQLAlchemy gives us a list so we need to access the first element in it. We could use `uselist=False` in the backref, but we'll need to adjust all the plugins at one as otherwise we break pagure/ui/plugins.py. --- diff --git a/pagure/lib/lib_ci.py b/pagure/lib/lib_ci.py index 9853811..4e8f9ee 100644 --- a/pagure/lib/lib_ci.py +++ b/pagure/lib/lib_ci.py @@ -38,8 +38,8 @@ def process_jenkins_build(project, build_id): pull-request. """ import jenkins - jenk = jenkins.Jenkins(project.ci_hook.url) - jenkins_name = project.ci_hook.url.split('/job/', 1)[1].split('/', 1)[0] + jenk = jenkins.Jenkins(project.ci_hook[0].url) + jenkins_name = project.ci_hook[0].url.split('/job/', 1)[1].split('/', 1)[0] build_info = jenk.get_build_info(jenkins_name, build_id) result = build_info['result'] url = build_info['url'] diff --git a/pagureCI/pagure_ci_server.py b/pagureCI/pagure_ci_server.py index a951646..8b43c65 100644 --- a/pagureCI/pagure_ci_server.py +++ b/pagureCI/pagure_ci_server.py @@ -94,7 +94,7 @@ def handle_messages(): log.info("Trigger on %s PR #%s from %s: %s", project.fullname, pr_id, repo, branch) - url = project.ci_hook.ci_url + url = project.ci_hook[0].ci_url if url.endswith('/'): url = url[:-1]