Merge "zuul-web: jobs list endpoint: return 404 when tenant not found"

This commit is contained in:
Zuul 2018-07-15 17:26:42 +00:00 committed by Gerrit Code Review
commit 14df958306
2 changed files with 5 additions and 1 deletions

View File

@ -379,3 +379,6 @@ class TestBuildInfo(ZuulDBTestCase, BaseTestWeb):
builds = self.get_url("api/tenant/tenant-one/builds").json() builds = self.get_url("api/tenant/tenant-one/builds").json()
self.assertEqual(len(builds), 6) self.assertEqual(len(builds), 6)
resp = self.get_url("api/tenant/non-tenant/builds")
self.assertEqual(404, resp.status_code)

View File

@ -314,7 +314,8 @@ class ZuulWebAPI(object):
connection_name = json.loads(job.data[0]) connection_name = json.loads(job.data[0])
if not connection_name: if not connection_name:
raise Exception("Unable to find connection for tenant %s" % tenant) raise cherrypy.HTTPError(404, 'Tenant %s does not exist.' % tenant)
connection = self.zuulweb.connections.connections[connection_name] connection = self.zuulweb.connections.connections[connection_name]
args = { args = {