summaryrefslogtreecommitdiff
path: root/ick2/workapi.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-26 23:01:28 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-26 23:01:28 +0100
commite323455e21d8d9141ada6f32ba1f609291c077c7 (patch)
treef9f922f11960d4f5c87a3f4b1021ec8f42e9100f /ick2/workapi.py
parent2e1136d8427e8dd6bb8a7e6a316fbb6f8e61cf46 (diff)
downloadick2-e323455e21d8d9141ada6f32ba1f609291c077c7.tar.gz
Fix: return the right project
Previously, return the first project that named the wanted pipeline.
Diffstat (limited to 'ick2/workapi.py')
-rw-r--r--ick2/workapi.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/ick2/workapi.py b/ick2/workapi.py
index 9359150..f140108 100644
--- a/ick2/workapi.py
+++ b/ick2/workapi.py
@@ -185,13 +185,18 @@ class WorkAPI(ick2.APIbase):
name, doing.get(name), update[name]))
def _get_pipeline(self, project, pipeline): # pragma: no cover
- projects = self._projects.get_projects()
- for p in projects:
- for name in p['pipelines']:
- if name == pipeline:
- pt = self._state.get_resource('pipelines', name)
- return p, pt
- raise ick2.NotFound()
+ projects = [
+ p
+ for p in self._projects.get_projects()
+ if p['project'] == project
+ ]
+ if not projects:
+ raise ick2.NotFound()
+ p = projects[0]
+ if pipeline not in p['pipelines']:
+ raise ick2.NotFound()
+ pt = self._state.get_resource('pipelines', pipeline)
+ return p, pt
def _append_to_build_log(self, update):
build_id = update['build_id']