Merge "zuul-web: config_errors endpoint: return 404 when tenant not found"
This commit is contained in:
commit
d48787c07d
|
@ -342,6 +342,9 @@ class TestTenantInfoConfigBroken(BaseTestWeb):
|
|||
self.assertIn('Zuul encountered a syntax error',
|
||||
config_errors[0]['error'])
|
||||
|
||||
resp = self.get_url("api/tenant/non-tenant/config-errors")
|
||||
self.assertEqual(404, resp.status_code)
|
||||
|
||||
|
||||
class TestWebSocketInfo(TestInfo):
|
||||
|
||||
|
|
|
@ -367,6 +367,9 @@ class RPCListener(object):
|
|||
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(),
|
||||
|
|
|
@ -280,6 +280,8 @@ class ZuulWebAPI(object):
|
|||
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)
|
||||
resp = cherrypy.response
|
||||
resp.headers['Access-Control-Allow-Origin'] = '*'
|
||||
return ret
|
||||
|
|
Loading…
Reference in New Issue