Designate unit tests fail with jsonschema>=4.16.0

Bug #1992677 reported by Michael Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Critical
Michael Johnson

Bug Description

Designate unit tests will fail when run with jsonschema >= 4.16.0 due to a change in a parameter type[1]. Basically the "store" parameter is now a pyrsistent map type instead of a simple tuple.

Looking at the jsonschema code, we are attempting to pass in the default values[2] anyway, so I think we can just remove those parameters from the init.

An example error:

Traceback (most recent call last):
  File "/home/zuul/src/opendev.org/openstack/designate/designate/tests/test_schema/__init__.py", line 22, in test_constructor
    quota = schema.Schema('admin', 'quota')
  File "/home/zuul/src/opendev.org/openstack/designate/designate/schema/__init__.py", line 30, in __init__
    self.resolver = resolvers.LocalResolver.from_schema(
  File "/home/zuul/src/opendev.org/openstack/designate/designate/schema/resolvers.py", line 32, in from_schema
    resolver = cls(schema.get("id", ""), schema, *args, **kwargs)
  File "/home/zuul/src/opendev.org/openstack/designate/designate/schema/resolvers.py", line 27, in __init__
    super(LocalResolver, self).__init__(base_uri, referrer, (), True)
  File "/home/zuul/src/opendev.org/openstack/designate/.tox/py310/lib/python3.10/site-packages/jsonschema/validators.py", line 738, in __init__
    for schema in store.values() if "$id" in schema
AttributeError: 'tuple' object has no attribute 'values'

[1] https://github.com/python-jsonschema/jsonschema/commit/d9e093d439ab3023ffb644d620155e277032740c
[2] https://github.com/python-jsonschema/jsonschema/blob/main/jsonschema/validators.py#L717

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/designate/+/861098

Changed in designate:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.opendev.org/c/openstack/designate/+/861098
Committed: https://opendev.org/openstack/designate/commit/d6eabef4deeb4632d39aec91a1a83ce9fbe0853a
Submitter: "Zuul (22348)"
Branch: master

commit d6eabef4deeb4632d39aec91a1a83ce9fbe0853a
Author: Michael Johnson <email address hidden>
Date: Wed Oct 12 16:50:57 2022 +0000

    Fixes compatibility with jsonschema >= 4.16.0

    Jsonschema has changed the type of a parameter from a simple
    tuple to a pyrsistent map object. Since we were passing in the
    defaults anyway, this patch removes those parameters from the
    jsonschema call. This makes designate compatible with
    jsonschema >= 4.16.0.

    Closes-Bug: #1992677
    Change-Id: I9cc94506a63371ad78b204030e5e87339982e9e7

Changed in designate:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 16.0.0.0rc1

This issue was fixed in the openstack/designate 16.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.