From e60b31706240d989ba6d0244acbbb97154c47a13 Mon Sep 17 00:00:00 2001 From: Sharpz7 Date: Fri, 8 Nov 2024 21:59:40 +0000 Subject: [PATCH] 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 --- tempest/lib/common/rest_client.py | 5 +++++ tempest/lib/exceptions.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tempest/lib/common/rest_client.py b/tempest/lib/common/rest_client.py index b656b7a546..b360569dcc 100644 --- a/tempest/lib/common/rest_client.py +++ b/tempest/lib/common/rest_client.py @@ -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) diff --git a/tempest/lib/exceptions.py b/tempest/lib/exceptions.py index dd7885e014..0242de2e12 100644 --- a/tempest/lib/exceptions.py +++ b/tempest/lib/exceptions.py @@ -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"