summaryrefslogtreecommitdiff
path: root/ick2/controllerapi.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-05 14:52:40 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-05 14:52:40 +0100
commitf49ebd90e1d16b51da1523c9767c387e59771b41 (patch)
tree702ef644299d24d141045ff9fab869c68fa8df29 /ick2/controllerapi.py
parent3fc701a748eecf90956459b5ffe753beb6695e37 (diff)
downloadick2-f49ebd90e1d16b51da1523c9767c387e59771b41.tar.gz
Add: get pipeline status for a project
Diffstat (limited to 'ick2/controllerapi.py')
-rw-r--r--ick2/controllerapi.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py
index 09d14bc..63daa94 100644
--- a/ick2/controllerapi.py
+++ b/ick2/controllerapi.py
@@ -226,6 +226,28 @@ class ProjectAPI(ResourceApiBase):
def get_resource_name(self, resource):
return resource['project']
+ def get_routes(self, path): # pragma: no cover
+ return super().get_routes(path) + self.get_pipeline_routes(path)
+
+ def get_pipeline_routes(self, path): # pragma: no cover
+ pipeline_path = '{}/<project>/pipelines/<pipeline>'.format(path)
+ return [
+ {
+ 'method': 'GET',
+ 'path': pipeline_path,
+ 'callback': self.GET(self.get_pipeline),
+ },
+ ]
+
+ def get_pipeline(self, project, pipeline):
+ p = self._state.get_resource(self._type_name, project)
+ for pl in p['pipelines']:
+ if pl['name'] == pipeline:
+ return {
+ 'status': pl.get('status', 'idle'),
+ }
+ raise ick2.NotFound()
+
def response(status_code, body, headers): # pragma: no cover
obj = {