Fix the status code of over quota response
Server will response 403 instead of 500 when quota exceeded. Change-Id: I3cd26929c2a4b1011bea957d59481409e48403de Closes-Bug: #1799110
This commit is contained in:
parent
c90642c4b2
commit
4b0cf9aae2
@ -470,12 +470,7 @@ class ContainersController(base.Controller):
|
||||
except TypeError as e:
|
||||
raise e
|
||||
check_kwargs[res_name] = total
|
||||
try:
|
||||
QUOTAS.limit_check(context, project_id, **check_kwargs)
|
||||
except exception.OverQuota as exc:
|
||||
# Set HTTP response status code
|
||||
pecan.response.status = 403
|
||||
raise exc
|
||||
QUOTAS.limit_check(context, project_id, **check_kwargs)
|
||||
|
||||
_check_deltas(context, deltas)
|
||||
|
||||
|
@ -707,6 +707,7 @@ class ServerNotUsable(ZunException):
|
||||
|
||||
class OverQuota(ZunException):
|
||||
message = _("Quota exceeded for resources: %(overs)s")
|
||||
code = 403
|
||||
|
||||
|
||||
class QuotaNotFound(NotFound):
|
||||
|
Loading…
x
Reference in New Issue
Block a user