glanceclient has no support to add type while creating md-property for namespace

Bug #1934626 reported by Abhishek Kekane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
In Progress
Low
Cyril Roelandt

Bug Description

python-glanceclient has no support to add type while creating md-property for namespace using md-property-create command.

glance help md-property-create
usage: glance md-property-create --name <NAME> --title <TITLE> --schema
                                 <SCHEMA>
                                 <NAMESPACE>

Create a new metadata definitions property inside a namespace.

Positional arguments:
  <NAMESPACE> Name of namespace the property will belong.

Optional arguments:
  --name <NAME> Internal name of a property.
  --title <TITLE> Property name displayed to the user.
  --schema <SCHEMA> Valid JSON schema of a property.

glance md-property-create OS::Admin::TestingNameSpace --name testing_property --title "Testing Property" --schema {}
'type' is a required property

Failed validating 'required' in schema:
    {'additionalProperties': False,
     'definitions': {'positiveInteger': {'minimum': 0, 'type': 'integer'},
                     'positiveIntegerDefault0': {'allOf': [{'$ref': '#/definitions/positiveInteger'},
                                                           {'default': 0}]},
                     'stringArray': {'items': {'type': 'string'},
                                     'minItems': 1,
                                     'type': 'array',
                                     'uniqueItems': True}},
     'name': 'property',
     'properties': {'additionalItems': {'type': 'boolean'},
                    'default': {},
                    'description': {'type': 'string'},
                    'enum': {'type': 'array'},
                    'items': {'properties': {'enum': {'type': 'array'},
                                             'type': {'enum': ['array',
                                                               'boolean',
                                                               'integer',
                                                               'number',
                                                               'object',
                                                               'string',
                                                               None],
                                                      'type': 'string'}},
                              'type': 'object'},
                    'maxItems': {'$ref': '#/definitions/positiveInteger'},
                    'maxLength': {'$ref': '#/definitions/positiveInteger'},
                    'maximum': {'type': 'number'},
                    'minItems': {'$ref': '#/definitions/positiveIntegerDefault0'},
                    'minLength': {'$ref': '#/definitions/positiveIntegerDefault0'},
                    'minimum': {'type': 'number'},
                    'name': {'maxLength': 80, 'type': 'string'},
                    'operators': {'items': {'type': 'string'},
                                  'type': 'array'},
                    'pattern': {'format': 'regex', 'type': 'string'},
                    'readonly': {'type': 'boolean'},
                    'required': {'$ref': '#/definitions/stringArray'},
                    'title': {'type': 'string'},
                    'type': {'enum': ['array',
                                      'boolean',
                                      'integer',
                                      'number',
                                      'object',
                                      'string',
                                      None],
                             'type': 'string'},
                    'uniqueItems': {'default': False, 'type': 'boolean'}},
     'required': ['type', 'title', 'name']}

On instance:
    {'name': 'testing_property', 'title': 'Testing Property'}

API reference: https://docs.openstack.org/api-ref/image/v2/metadefs-index.html?expanded=create-object-detail,create-property-detail#create-property

Changed in python-glanceclient:
importance: Undecided → Medium
Revision history for this message
Abhishek Kekane (abhishek-kekane) wrote :

So as I suspect we can use --schema to pass all this information, we need either update the help message in client or else need to add examples in docs about how to create metadefs.

But IMO as it is required option we should make this provision to pass it explicitly and not through the json.

Changed in python-glanceclient:
importance: Medium → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)
Changed in python-glanceclient:
status: New → In Progress
Changed in python-glanceclient:
assignee: nobody → Cyril Roelandt (cyril-roelandt)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-glanceclient 4.4.0

This issue was fixed in the openstack/python-glanceclient 4.4.0 release.

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.