summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2022-07-14 17:56:31 +0200
committerDmitry Tantsur <dtantsur@protonmail.com>2022-07-28 14:21:52 +0000
commitf14da8ed97dbcc8fd380630748df97745a32ec9f (patch)
tree93b88b9592ae41a24bfc5cf58363d523f300f311
parent249cbf2abaeaedefdea5c9eca9783572e9fc2cd5 (diff)
downloadironic-f14da8ed97dbcc8fd380630748df97745a32ec9f.tar.gz
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 (cherry picked from commit 55b9579f14ea08a2dc732336d8f552cc14ab895d)
-rw-r--r--ironic/api/controllers/v1/network-data-schema.json2
-rw-r--r--ironic/api/controllers/v1/node.py1
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_deploy_template.py2
-rw-r--r--releasenotes/notes/jsonschema-966f55fc79b916fc.yaml9
4 files changed, 12 insertions, 2 deletions
diff --git a/ironic/api/controllers/v1/network-data-schema.json b/ironic/api/controllers/v1/network-data-schema.json
index 7162daf34..c27c84871 100644
--- a/ironic/api/controllers/v1/network-data-schema.json
+++ b/ironic/api/controllers/v1/network-data-schema.json
@@ -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",
diff --git a/ironic/api/controllers/v1/node.py b/ironic/api/controllers/v1/node.py
index bfba203d1..483850225 100644
--- a/ironic/api/controllers/v1/node.py
+++ b/ironic/api/controllers/v1/node.py
@@ -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']},
diff --git a/ironic/tests/unit/api/controllers/v1/test_deploy_template.py b/ironic/tests/unit/api/controllers/v1/test_deploy_template.py
index b86fb0b1d..63784fef3 100644
--- a/ironic/tests/unit/api/controllers/v1/test_deploy_template.py
+++ b/ironic/tests/unit/api/controllers/v1/test_deploy_template.py
@@ -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(
diff --git a/releasenotes/notes/jsonschema-966f55fc79b916fc.yaml b/releasenotes/notes/jsonschema-966f55fc79b916fc.yaml
new file mode 100644
index 000000000..20c1f7247
--- /dev/null
+++ b/releasenotes/notes/jsonschema-966f55fc79b916fc.yaml
@@ -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.