Error when using glance image-download with progress flag

Bug #1384664 reported by Itzik Brown
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Medium
Louis Taylor

Bug Description

Version
=======
Juno rc1 on RHEL7
python-glance-store-0.1.8-1.el7.centos.noarch
openstack-glance-2014.2-1.el7.centos.noarch
python-glance-2014.2-1.el7.centos.noarch
python-glanceclient-0.14.1-1.el7.centos.noarch

Description
===========
When running the following command:
# glance image-download --file image1 image1 --progress

I get the following error:
object of type 'generator' has no len()

Revision history for this message
John Schwarz (jschwarz) wrote :

Confirmed this bug occurs.

Changed in python-glanceclient:
status: New → Confirmed
Revision history for this message
Gaëtan Trellu (goldyfruit) wrote :

Same for me but on RHEL 7 + OSP 5 (IceHouse)

Revision history for this message
Louis Taylor (kragniz) wrote :

I can also confirm for the v2 api.

$ glance --os-image-api-version 2 image-download --file image1 image1 --progress
object of type 'generator' has no len()

Revision history for this message
Louis Taylor (kragniz) wrote :

This was broken in the move to requests (https://review.openstack.org/#/c/78269/).

Louis Taylor (kragniz)
Changed in python-glanceclient:
assignee: nobody → Louis Taylor (kragniz)
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/132432

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

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

commit df02ee8e2a10d2f37a9c013dec157c88b8dce49d
Author: Louis Taylor <email address hidden>
Date: Sat Nov 1 20:49:03 2014 +0000

    Fix Requests breaking download progress bar

    The move to the requests library (dbb242b) broke the progress bar during
    downloading an image with --progress enabled, due to requests returning
    a generator, which has no __len__ function. This patch adds an iterable
    wrapper which provides the length, sourced from Content-Length headers.

    Closes-Bug: #1384664

    Change-Id: I48598a824396bc6e7cba69eb3ce32e7c8f30a18a

Changed in python-glanceclient:
status: In Progress → Fix Committed
Louis Taylor (kragniz)
Changed in python-glanceclient:
status: Fix Committed → Fix Released
Revision history for this message
Zoltan Arnold Nagy (zoltan) wrote :

I'm seeing this at Kilo with the following package:

1:0.15.0-0ubuntu1~cloud0

Here is the output:

root@ng:/tmp# glance --debug image-download --file sysbench-image.raw --progress 075eb535-376f-44a0-aad1-a8bb9c1b775a
[...]
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/glanceclient/shell.py", line 637, in main
    args.func(client, args)
  File "/usr/lib/python2.7/dist-packages/glanceclient/v1/shell.py", line 150, in do_image_download
    body = progressbar.VerboseIteratorWrapper(body, len(body))
TypeError: object of type 'generator' has no len()
object of type 'generator' has no len()
root@ng:/tmp#

Revision history for this message
wobs (shengboyu) wrote :

where could i get this correction?

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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