diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-07-14 17:56:31 +0200 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-07-28 14:20:49 +0000 |
commit | 73eac6bdced62b29242090d582f7c3f08b82e80a (patch) | |
tree | 41075fa334c5c5c56738a32a5cf85202186c12d6 | |
parent | ffa03a6182d033367cf04446e28a7155ed0defc1 (diff) | |
download | ironic-73eac6bdced62b29242090d582f7c3f08b82e80a.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)
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 f182e2fd2..2ef369e13 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. |