2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-29 00:31:09 +00:00

Properly respond with not found under by-type and by-model

Previously, a KeyError would trigger Unexpected error, correct this.
This commit is contained in:
Jarrod Johnson
2017-05-08 16:53:55 -04:00
parent 777c419cb8
commit 0e9e5da102
@@ -228,8 +228,12 @@ def handle_api_request(configmanager, inputdata, operation, pathcomponents):
return disco_info[pathcomponents[1]](ident=pathcomponents[2])
elif len(pathcomponents) == 4:
if pathcomponents[1] == 'by-model':
if pathcomponents[3] not in disco_info:
raise exc.NotFoundException()
return disco_info[pathcomponents[3]](model=pathcomponents[2])
elif pathcomponents[1] == 'by-type':
if pathcomponents[3] not in disco_info:
raise exc.NotFoundException()
return disco_info[pathcomponents[3]](infotype=pathcomponents[2])
elif len(pathcomponents) == 5:
ident = pathcomponents[-1]