Fix the HTTP code of the BadRequest exception

We have both Invalid and BadRequest which result in HTTP 400 and 500
accordingly. The latter is clearly incorrect.

Then we have NotFound and HTTPNotFound which mean the same thing.

Alias exceptions in both cases with the intention to drop one copy.

Finally, NotAuthorized and Unauthorized result in HTTP 403 and 500
again. Fortunately, the latter is not used and can be removed.

Change-Id: If9d571792a8617dd6ecf17e163dea252cb0f7fae
This commit is contained in:
Dmitry Tantsur 2023-06-29 14:37:27 +02:00
parent 76a920aed2
commit 6428116212

View File

@ -425,8 +425,8 @@ class Forbidden(IronicException):
_msg_fmt = _("Requested OpenStack Images API is forbidden")
class BadRequest(IronicException):
pass
# TODO(dtantsur): leave only one variant
BadRequest = Invalid
class InvalidEndpoint(IronicException):
@ -441,12 +441,8 @@ class HTTPForbidden(NotAuthorized):
_msg_fmt = _("Access was denied to the following resource: %(resource)s")
class Unauthorized(IronicException):
pass
class HTTPNotFound(NotFound):
pass
# TODO(dtantsur): leave only one variant
HTTPNotFound = NotFound
class ConfigNotFound(IronicException):