Fix compatibility with jsonschema>=4.0.0

Specify the schema version for network_data and node, otherwise the
latest one is used.

Also fix one test where the error messages was changed.

Change-Id: I4a614d7e73348bbe6c355a40881b013cbfe00b03
This commit is contained in:
Dmitry Tantsur 2022-07-14 17:56:31 +02:00
parent 0c4401cfbb
commit 55b9579f14
4 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,5 @@
{
"$schema": "http://openstack.org/nova/network_data.json#",
"$schema": "http://json-schema.org/draft-07/schema#",
"id": "http://openstack.org/nova/network_data.json",
"type": "object",
"title": "OpenStack Nova network metadata schema",

View File

@ -140,6 +140,7 @@ def network_data_schema():
def node_schema():
network_data = network_data_schema()
return {
'$schema': 'http://json-schema.org/draft-07/schema#',
'type': 'object',
'properties': {
'automated_clean': {'type': ['string', 'boolean', 'null']},

View File

@ -883,7 +883,7 @@ class TestPost(BaseDeployTemplatesAPITest):
def test_create_invalid_step_field_priority(self):
self._test_create_invalid_step_field(
'priority', 'not a number',
"'not a number' is not of type 'integer'")
"'not a number'") # differs between jsonschema versions
def test_create_invalid_step_field_negative_priority(self):
self._test_create_invalid_step_field(

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fixes compatibility with ``jsonschema`` package version 4.0.0 or newer
by providing a proper schema version (Draft-07 currently).
issues:
- |
When using ``jsonschema`` 4.0.0 or newer, make sure to include a proper
``$schema`` field in your custom network data or RAID schemas.