summaryrefslogtreecommitdiff
path: root/zuul/web
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-12-29 14:39:17 +0000
committerGerrit Code Review <review@openstack.org>2018-12-29 14:39:17 +0000
commitdcfeb3a42bc31d4aea15d3032fc162f97486891d (patch)
treea03535a082b6750dd6c72d4bc69e809b1f48c276 /zuul/web
parent0fc3485454e2a0c2ac57fcb9b7a8b5d9ffbaaab4 (diff)
parent8436ed38b7af1a698516f7bcc840510c1e9bb9f9 (diff)
downloadzuul-dcfeb3a42bc31d4aea15d3032fc162f97486891d.tar.gz
Merge "web: add /{tenant}/nodes route"
Diffstat (limited to 'zuul/web')
-rwxr-xr-xzuul/web/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/zuul/web/__init__.py b/zuul/web/__init__.py
index ff3154330..a3a50cb1e 100755
--- a/zuul/web/__init__.py
+++ b/zuul/web/__init__.py
@@ -363,6 +363,21 @@ class ZuulWebAPI(object):
@cherrypy.expose
@cherrypy.tools.save_params()
+ @cherrypy.tools.json_out(content_type='application/json; charset=utf-8')
+ def nodes(self, tenant):
+ ret = []
+ for node in self.zk.nodeIterator():
+ node_data = {}
+ for key in ("id", "type", "connection_type", "external_id",
+ "provider", "state", "state_time", "comment"):
+ node_data[key] = node.get(key)
+ ret.append(node_data)
+ resp = cherrypy.response
+ resp.headers['Access-Control-Allow-Origin'] = '*'
+ return ret
+
+ @cherrypy.expose
+ @cherrypy.tools.save_params()
def key(self, tenant, project):
job = self.rpc.submitJob('zuul:key_get', {'tenant': tenant,
'project': project,
@@ -619,6 +634,8 @@ class ZuulWeb(object):
controller=api, action='pipelines')
route_map.connect('api', '/api/tenant/{tenant}/labels',
controller=api, action='labels')
+ route_map.connect('api', '/api/tenant/{tenant}/nodes',
+ controller=api, action='nodes')
route_map.connect('api', '/api/tenant/{tenant}/key/{project:.*}.pub',
controller=api, action='key')
route_map.connect('api', '/api/tenant/{tenant}/'