zuul-web: jobs list endpoint: return 404 when tenant not found
Fix the endpoint to remove 500 error when tenant is not found. Change-Id: Ib748a5f3ffe526510ffbe53756effc2ae380696e
This commit is contained in:
parent
19afda37a3
commit
008e542737
|
@ -370,3 +370,6 @@ class TestBuildInfo(ZuulDBTestCase, BaseTestWeb):
|
|||
|
||||
builds = self.get_url("api/tenant/tenant-one/builds").json()
|
||||
self.assertEqual(len(builds), 6)
|
||||
|
||||
resp = self.get_url("api/tenant/non-tenant/builds")
|
||||
self.assertEqual(404, resp.status_code)
|
||||
|
|
|
@ -309,7 +309,8 @@ class ZuulWebAPI(object):
|
|||
connection_name = json.loads(job.data[0])
|
||||
|
||||
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]
|
||||
|
||||
args = {
|
||||
|
|
Loading…
Reference in New Issue