Merge "[placement] Add status and links fields to version document at /" into stable/queens

This commit is contained in:
Zuul 2020-10-15 00:06:54 +00:00 committed by Gerrit Code Review
commit 78ac573a6c
5 changed files with 37 additions and 1 deletions

View File

@ -32,6 +32,18 @@ def home(req):
'id': 'v%s' % min_version, 'id': 'v%s' % min_version,
'max_version': max_version, 'max_version': max_version,
'min_version': min_version, 'min_version': min_version,
# for now there is only ever one version, so it must be CURRENT
'status': 'CURRENT',
'links': [{
# Point back to this same URL as the root of this version.
# NOTE(cdent): We explicitly want this to be a relative-URL
# representation of "this same URL", otherwise placement needs
# to keep track of proxy addresses and the like, which we have
# avoided thus far, in order to construct full URLs. Placement
# is much easier to scale if we never track that stuff.
'rel': 'self',
'href': '',
}],
} }
version_json = jsonutils.dumps({'versions': [version_data]}) version_json = jsonutils.dumps({'versions': [version_data]})
req.response.body = encodeutils.to_utf8(version_json) req.response.body = encodeutils.to_utf8(version_json)

View File

@ -22,6 +22,8 @@ tests:
$.versions[0].max_version: /^\d+\.\d+$/ $.versions[0].max_version: /^\d+\.\d+$/
$.versions[0].min_version: /^\d+\.\d+$/ $.versions[0].min_version: /^\d+\.\d+$/
$.versions[0].id: v1.0 $.versions[0].id: v1.0
$.versions[0].status: CURRENT
$.versions[0].links[?rel = 'self'].href: ''
- name: unavailable microversion raises 406 - name: unavailable microversion raises 406
GET: / GET: /

View File

@ -3,7 +3,14 @@
{ {
"min_version" : "1.0", "min_version" : "1.0",
"id" : "v1.0", "id" : "v1.0",
"max_version" : "1.2" "max_version" : "1.17",
"status": "CURRENT",
"links": [
{
"href": "",
"rel": "self"
}
]
} }
] ]
} }

View File

@ -416,6 +416,12 @@ version_id:
required: true required: true
description: > description: >
A common name for the version being described. Informative only. A common name for the version being described. Informative only.
version_links:
type: array
in: body
required: true
description: >
A list of links related to and describing this version.
version_max: version_max:
type: string type: string
in: body in: body
@ -428,6 +434,13 @@ version_min:
required: true required: true
description: > description: >
The minimum microversion that is supported. The minimum microversion that is supported.
version_status:
type: string
in: body
required: true
description: >
The status of the version being described. With placement this is
"CURRENT".
versions: versions:
type: array type: array
in: body in: body

View File

@ -41,6 +41,8 @@ Response
- id: version_id - id: version_id
- min_version: version_min - min_version: version_min
- max_version: version_max - max_version: version_max
- status: version_status
- links: version_links
Response Example Response Example
---------------- ----------------