Merge "Follow-up: Use `microversion-parse
` to parse version headers in API requests"
This commit is contained in:
commit
3c5b4cb349
@ -12,10 +12,15 @@ supports versioning. There are two kinds of versions in Ironic.
|
|||||||
|
|
||||||
- ''major versions'', which have dedicated urls.
|
- ''major versions'', which have dedicated urls.
|
||||||
- ''microversions'', which can be requested through the use of the
|
- ''microversions'', which can be requested through the use of the
|
||||||
``X-OpenStack-Ironic-API-Version`` header.
|
``X-OpenStack-Ironic-API-Version`` header or the new standard singular header
|
||||||
|
``OpenStack-API-Version: baremetal <version>``.
|
||||||
|
|
||||||
The Version APIs work differently from other APIs as they *do not* require authentication.
|
The Version APIs work differently from other APIs as they *do not* require authentication.
|
||||||
|
|
||||||
|
Upon the Dalmatian release, all API requests support the
|
||||||
|
new standard singular header ``OpenStack-API-Version: baremetal <version>``.
|
||||||
|
If that's not present, we fall back to the legacy headers.
|
||||||
|
|
||||||
Beginning with the Kilo release, all API requests support the
|
Beginning with the Kilo release, all API requests support the
|
||||||
``X-OpenStack-Ironic-API-Version`` header. This header SHOULD be supplied
|
``X-OpenStack-Ironic-API-Version`` header. This header SHOULD be supplied
|
||||||
with every request; in the absence of this header, each request is treated
|
with every request; in the absence of this header, each request is treated
|
||||||
|
@ -71,6 +71,11 @@ class TestVersion(base.BaseApiTest):
|
|||||||
{cbase.Version.string: '123.456'}, mock.ANY, mock.ANY)
|
{cbase.Version.string: '123.456'}, mock.ANY, mock.ANY)
|
||||||
self.assertEqual((123, 456), version)
|
self.assertEqual((123, 456), version)
|
||||||
|
|
||||||
|
def test_parse_new_standard_singular_header_ok(self):
|
||||||
|
version = cbase.Version.parse_headers(
|
||||||
|
{'OpenStack-API-Version': 'baremetal 123.456'}, mock.ANY, mock.ANY)
|
||||||
|
self.assertEqual((123, 456), version)
|
||||||
|
|
||||||
def test_parse_headers_latest(self):
|
def test_parse_headers_latest(self):
|
||||||
for s in ['latest', 'LATEST']:
|
for s in ['latest', 'LATEST']:
|
||||||
version = cbase.Version.parse_headers(
|
version = cbase.Version.parse_headers(
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Delegate parsing of version headers in API requests to the
|
||||||
|
``microversion-parse`` library which also adds support for the new
|
||||||
|
standard singular header: 'OpenStack-API-Version: baremetal <version>'.
|
Loading…
x
Reference in New Issue
Block a user