Correct bug in microversion headers in placement
Found a small bug in the handling of a 406 error by the placement API's microversion handling code that only appeared when more than one microversion was used. Change-Id: I8562e9ce962352033e43a3b993f8b8ba6f211fd4
This commit is contained in:
parent
16f4bad6d3
commit
98d629a1a0
@ -109,7 +109,7 @@ def json_error_formatter(body, status, title, environ):
|
||||
microversion = nova.api.openstack.placement.microversion
|
||||
if status_code == 406 and microversion.MICROVERSION_ENVIRON not in environ:
|
||||
error_dict['max_version'] = microversion.max_version_string()
|
||||
error_dict['min_version'] = microversion.max_version_string()
|
||||
error_dict['min_version'] = microversion.min_version_string()
|
||||
|
||||
return {'errors': [error_dict]}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
"""Unit tests for the utility functions used by the placement API."""
|
||||
|
||||
|
||||
import fixtures
|
||||
from oslo_middleware import request_id
|
||||
import webob
|
||||
|
||||
@ -143,6 +144,15 @@ class TestJSONErrorFormatter(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(TestJSONErrorFormatter, self).setUp()
|
||||
self.environ = {}
|
||||
# TODO(jaypipes): Remove this when we get more than a single version
|
||||
# in the placement API. The fact that we only had a single version was
|
||||
# masking a bug in the utils code.
|
||||
_versions = [
|
||||
'1.0',
|
||||
'1.1',
|
||||
]
|
||||
mod_str = 'nova.api.openstack.placement.microversion.VERSIONS'
|
||||
self.useFixture(fixtures.MonkeyPatch(mod_str, _versions))
|
||||
|
||||
def test_status_to_int_code(self):
|
||||
body = ''
|
||||
|
Loading…
Reference in New Issue
Block a user