recognize 429 as an rate limiting status

currently novaclient recognize 413 as rate limiting status while
it shoule be 429 according to HTTP protocol.

fixes bug 1191874

Change-Id: Ib1ae54f7d13d0ca579dd264e8d0d7630770e92d6
This commit is contained in:
Jiajun Liu 2013-07-16 09:35:42 +00:00
parent 74506b83fe
commit 1b5ed91650
1 changed files with 10 additions and 1 deletions

View File

@ -148,6 +148,14 @@ class OverLimit(ClientException):
super(OverLimit, self).__init__(*args, **kwargs)
class RateLimit(OverLimit):
"""
HTTP 429 - Rate limit: you've sent too many requests for this time period.
"""
http_status = 429
message = "Rate limit"
# NotImplemented is a python keyword.
class HTTPNotImplemented(ClientException):
"""
@ -164,7 +172,8 @@ class HTTPNotImplemented(ClientException):
#
# Instead, we have to hardcode it:
_error_classes = [BadRequest, Unauthorized, Forbidden, NotFound,
MethodNotAllowed, Conflict, OverLimit, HTTPNotImplemented]
MethodNotAllowed, Conflict, OverLimit, RateLimit,
HTTPNotImplemented]
_code_map = dict((c.http_status, c) for c in _error_classes)