Use config errors directly from layout in zuul-web
Change-Id: I47931f97c072029a03bb5c850a07e048a27a3ce7
This commit is contained in:
parent
e9b7c9577c
commit
bc3895e7e3
|
@ -147,7 +147,6 @@ class RPCListener(RPCListenerBase):
|
|||
'job_list',
|
||||
'project_get',
|
||||
'project_list',
|
||||
'config_errors_list',
|
||||
]
|
||||
|
||||
def start(self):
|
||||
|
@ -358,16 +357,3 @@ class RPCListener(RPCListenerBase):
|
|||
output.append(pobj)
|
||||
job.sendWorkComplete(json.dumps(
|
||||
sorted(output, key=lambda project: project["name"])))
|
||||
|
||||
def handle_config_errors_list(self, job):
|
||||
args = json.loads(job.arguments)
|
||||
tenant = self.sched.abide.tenants.get(args.get("tenant"))
|
||||
output = []
|
||||
if not tenant:
|
||||
job.sendWorkComplete(json.dumps(None))
|
||||
return
|
||||
for err in tenant.layout.loading_errors.errors:
|
||||
output.append({
|
||||
'source_context': err.key.context.toDict(),
|
||||
'error': err.error})
|
||||
job.sendWorkComplete(json.dumps(output))
|
||||
|
|
|
@ -1013,12 +1013,13 @@ class ZuulWebAPI(object):
|
|||
@cherrypy.expose
|
||||
@cherrypy.tools.save_params()
|
||||
@cherrypy.tools.json_out(content_type='application/json; charset=utf-8')
|
||||
def config_errors(self, tenant):
|
||||
config_errors = self.rpc.submitJob(
|
||||
'zuul:config_errors_list', {'tenant': tenant})
|
||||
ret = json.loads(config_errors.data[0])
|
||||
if ret is None:
|
||||
raise cherrypy.HTTPError(404, 'Tenant %s does not exist.' % tenant)
|
||||
def config_errors(self, tenant_name):
|
||||
tenant = self._getTenantOrRaise(tenant_name)
|
||||
ret = [
|
||||
{'source_context': e.key.context.toDict(),
|
||||
'error': e.error}
|
||||
for e in tenant.layout.loading_errors.errors
|
||||
]
|
||||
resp = cherrypy.response
|
||||
resp.headers['Access-Control-Allow-Origin'] = '*'
|
||||
return ret
|
||||
|
@ -1705,7 +1706,7 @@ class ZuulWeb(object):
|
|||
controller=api, action='buildsets')
|
||||
route_map.connect('api', '/api/tenant/{tenant}/buildset/{uuid}',
|
||||
controller=api, action='buildset')
|
||||
route_map.connect('api', '/api/tenant/{tenant}/config-errors',
|
||||
route_map.connect('api', '/api/tenant/{tenant_name}/config-errors',
|
||||
controller=api, action='config_errors')
|
||||
|
||||
for connection in connections.connections.values():
|
||||
|
|
Loading…
Reference in New Issue