diff options
-rw-r--r-- | ick2/workapi.py | 19 |
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'] |