Interoperable Image Import in glance documented format for inject not working as expected

Bug #2028895 reported by Rafael Lopez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Cyril Roelandt

Bug Description

According to the documentation, the correct way to specify custom import image metadata properties is:
"inject is a comma-separated list of properties and values that will be injected into the image record for the imported image. Each property and value should be quoted and separated by a colon (‘:’) as shown in the example above."

With the example being:
inject = "property1":"value1","property2":"value2",...

When specifying properties in this way the resulting properties in the imported image look like this:
properties | "property2"='"value2"', "property3"='"value3', os_glance_failed_import='', os_glance_importing_to_stores='', os_hash_algo='sha512', os_hash_value='cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e', os_hidden='False', owner_specified.openstack.md5='', owner_specified.openstack.object='images/proptest1', owner_specified.openstack.sha256='', property1"='"value1"', stores='local'

If you look closely at each of the properties, the quotes are inconsistent:
"property2"='"value2"'
"property3"='"value3
property1"='"value1"'

Conversely, if you use the following (no quotes):
inject = property1:value1,property2:value2,property3:value3

properties | os_glance_failed_import='', os_glance_importing_to_stores='', os_hash_algo='sha512', os_hash_value='cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e', os_hidden='False', owner_specified.openstack.md5='', owner_specified.openstack.object='images/proptest2', owner_specified.openstack.sha256='', property1='value1', property2='value2', property3='value3', stores='local'

Now it looks better:
property1='value1'
property2='value2'
property3='value3'

The resulting quotes using this format seem to match the other standard properties, ie. key='value' and I suspect what we are going for. I'm unclear if this is a parser issue or a documentation issue.

-----------------------------------
Release: 27.0.0.0b3.dev5 on 2022-08-30 13:35:51
SHA: 46c30f0b6db6ed6a86b1b84e69748025ad9050c6
Source: https://opendev.org/openstack/glance/src/doc/source/admin/interoperable-image-import.rst
URL: https://docs.openstack.org/glance/latest/admin/interoperable-image-import.html

summary: Interoperable Image Import in glance documented format for inject not
- working
+ working as expected
description: updated
Changed in glance:
assignee: nobody → Cyril Roelandt (cyril-roelandt)
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

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

Reviewed: https://review.opendev.org/c/openstack/glance/+/890423
Committed: https://opendev.org/openstack/glance/commit/dd9b3156cd1c5341b01c5befe2a2d13bab6e8d01
Submitter: "Zuul (22348)"
Branch: master

commit dd9b3156cd1c5341b01c5befe2a2d13bab6e8d01
Author: Cyril Roelandt <email address hidden>
Date: Wed Dec 13 04:13:40 2023 +0100

    inject_image_metadata plugin: Fix documentation

    The properties and values given to the "inject" option must not be
    quoted, otherwise the quotes become part of the values themselves.

    Change-Id: Ibcb8b8488253f459f40e6d34f4221832b7ff3839
    Closes-Bug: #2028895

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

This issue was fixed in the openstack/glance 28.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.