Workaround an openstacksdk bug
There was a bug[1] in the openstacksdk implementation that could cause load balancer delete calls to fail. This impacts the octavia dashboard ability to delete load balancers.
This patch adds a workaround for that bug until the impacted versions of openstacksdk have all gone EOL.
[1] https://review.opendev.org/c/openstack/openstacksdk/+/876669
Change-Id: I987211111ebff8d1be50ffd33ba91dc4adf4a709
(cherry picked from commit 5ed6f37519
)
This commit is contained in:
parent
d5013bf487
commit
4486d2416f
|
@ -32,7 +32,13 @@ class ContentTypeHook(hooks.PecanHook):
|
|||
# so we need to bypass the Octavia content type restrictions.
|
||||
if state.request.path in _HEALTHCHECK_PATHS:
|
||||
return
|
||||
if state.request.accept:
|
||||
# TODO(johnsom) Testing for an empty string is a workaround for an
|
||||
# openstacksdk bug present up to the initial
|
||||
# antelope release of openstacksdk. This means the
|
||||
# octavia dashboard would also be impacted.
|
||||
# This can be removed once antelope is EOL.
|
||||
# See: https://review.opendev.org/c/openstack/openstacksdk/+/876669
|
||||
if state.request.accept and state.request.accept.header_value != '':
|
||||
best_matches = state.request.accept.acceptable_offers(
|
||||
[constants.APPLICATION_JSON])
|
||||
if not best_matches:
|
||||
|
|
|
@ -51,6 +51,20 @@ class TestContentTypes(base_db_test.OctaviaDBTestBase):
|
|||
self.assertEqual(200, response.status_code)
|
||||
self.assertEqual(constants.APPLICATION_JSON, response.content_type)
|
||||
|
||||
# TODO(johnsom) Testing for an empty string is a workaround for an
|
||||
# openstacksdk bug present up to the initial
|
||||
# antelope release of openstacksdk. This means the
|
||||
# octavia dashboard would also be impacted.
|
||||
# This test should change to a 406 error once the workaround
|
||||
# is removed.
|
||||
# See: https://review.opendev.org/c/openstack/openstacksdk/+/876669
|
||||
def test_empty_accept_header(self):
|
||||
response = self.app.get(
|
||||
self.test_url, status=200, expect_errors=False,
|
||||
headers={constants.ACCEPT: ''})
|
||||
self.assertEqual(200, response.status_code)
|
||||
self.assertEqual(constants.APPLICATION_JSON, response.content_type)
|
||||
|
||||
# Note: webob will treat invalid content types as no accept header provided
|
||||
def test_bogus_accept_header(self):
|
||||
response = self.app.get(
|
||||
|
|
Loading…
Reference in New Issue