Check for fields['data'] missing leading to strange behavior

Bug #1259357 reported by Yanis Guenane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Undecided
Jon Bernard

Bug Description

When a user run the glance image-create/image-updage command with --location and --progress s/he gets presented with 'data' as the output. Not what expected, but the data get inserted.

This is due to the fact that some action relies on the fields['data'] value, but the presence of this value is not tested.

For example :

https://github.com/openstack/python-glanceclient/blob/master/glanceclient/v1/shell.py#L225
https://github.com/openstack/python-glanceclient/blob/master/glanceclient/v1/shell.py#L303

Command

glance image-create --name plop2 --disk-format qcow2 --container-format bare --location http://download.fedoraproject.org/pub/fedora/linux/releases/19/Images/x86_64/Fedora-x86_64-19-20130627-sda.qcow2 --progress

Possible solution :

A proper try/catch, in case it goes to raise display a message that this option (progress) is not avaialable with --location but keep processing normally

description: updated
Jon Bernard (jbernard)
Changed in python-glanceclient:
assignee: nobody → Jon Bernard (jbernard)
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/70396

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

Reviewed: https://review.openstack.org/70396
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=0934b978979ddc83bc3d286455abaf91f23bc5fc
Submitter: Jenkins
Branch: master

commit 0934b978979ddc83bc3d286455abaf91f23bc5fc
Author: Jon Bernard <email address hidden>
Date: Fri Jan 31 13:54:44 2014 -0500

    Only show progress bar for local image files

    This patch fixes a bug where both 'location' and 'progress' are passed
    as command line arguments. In this case, the 'data' field is not
    present in the fields dict and therefore the progress option cannot be
    used. A check is added to make sure the user has specified both a local
    image file and the progress flag together.

    Change-Id: Ia563139ee8b56d54d480534986e4b619a503fbfc
    Closes-Bug: #1259357

Changed in python-glanceclient:
status: In Progress → Fix Committed
Revision history for this message
Tzach Shefi (tshefi) wrote :

Same issue on my Icehouse (RHOS), note using a downstream version which doesn't include this code commit yet, check code.
I'll recheck again on next version and update.

[root@puma31 ~(keystone_admin)]# glance image-create --name cirros2 --disk-format qcow2 --container-format bare --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img --progress
'data'

No image is created, no error is logged at api.log.

Version:
RHEL7
python-glanceclient-0.12.0-1.el7ost.noarch
python-glance-2014.1-2.el7ost.noarch
openstack-glance-2014.1-2.el7ost.noarch

Louis Taylor (kragniz)
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.