Added statuscode 406 support

Added "NotAllowed" exception support. In general, 406 is returned when the requested microversion is not supported.

https://specs.openstack.org/openstack/api-wg/guidelines/microversion_specification.html

Change-Id: If5dda8254e8077070e77e8d56ecc6721222ef410
This commit is contained in:
Sharpz7 2024-11-08 21:59:40 +00:00 committed by Adam McArthur
parent 14588c55b3
commit e60b317062
2 changed files with 10 additions and 0 deletions

View File

@ -881,6 +881,11 @@ class RestClient(object):
resp_body = self._parse_resp(resp_body)
raise exceptions.Gone(resp_body, resp=resp)
if resp.status == 406:
if parse_resp:
resp_body = self._parse_resp(resp_body)
raise exceptions.NotAcceptable(resp_body, resp=resp)
if resp.status == 409:
if parse_resp:
resp_body = self._parse_resp(resp_body)

View File

@ -94,6 +94,11 @@ class NotFound(ClientRestClientException):
message = "Object not found"
class NotAcceptable(ClientRestClientException):
status_code = 406
message = "Not Acceptable"
class Conflict(ClientRestClientException):
status_code = 409
message = "Conflict with state of target resource"