V2 shell import fails with schema types []

Bug #1401032 reported by Flavio Percoco
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
High
Flavio Percoco

Bug Description

After I75da1e9309e0f7ef8839dea3ec9c99c58edc5d63 landed, some properties in the schema changed their type from bare `string` to either `string` or `null`. The way this is expressed in jsonschema is by adding a list to the `type` attribute in the schema definition.

Our glanceclient, uses the schema returned by the service to introspect the types of some of the properties in the `schema_args` utility. Unfortunately, this function fails for `type` values that are not in the typemap. Furthermore, `lists` are not hashable types, therefore they cannot be used as keys in the typemap.

The `schema_args` function needs to be enhanced to handle the new values returned by the server.

https://github.com/openstack/python-glanceclient/blob/master/glanceclient/common/utils.py#L89

Changed in python-glanceclient:
assignee: nobody → Flavio Percoco (flaper87)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/140624

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

Reviewed: https://review.openstack.org/140624
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=3989cd202de5d122da011be4f3bb9cede2fe8d45
Submitter: Jenkins
Branch: master

commit 3989cd202de5d122da011be4f3bb9cede2fe8d45
Author: Flavio Percoco <email address hidden>
Date: Wed Dec 10 10:47:40 2014 +0100

    Support schema types with non-str value

    Change I75da1e9309e0f7ef8839dea3ec9c99c58edc5d63 introduced some
    properties' types which are not string. This broke the `schema_args`
    utility since lists are not hashable and there was no support for such
    type values.

    This patch fixes this issue with a very glance specific strategy in
    which this values are assumed to have a `null` type and another type -
    string, integer, etc. The fix ignores `null` options and it takes the
    first non-null type as the valid one.

    The patch adds support for enum types that accept `None`

    Closes-bug: #1401032
    Change-Id: I250e8912aca262a56c54ac59bb24f917e5d8cfce

Changed in python-glanceclient:
status: In Progress → Fix Committed
Changed in python-glanceclient:
status: Fix Committed → Fix Released
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.