listing with --human-readable can stack trace

Bug #1495632 reported by Stuart McLaren on 2015-09-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Medium
Stuart McLaren
Nominated for Kilo by Erno Kuvaja
Liberty
Medium
Stuart McLaren

Bug Description

If an image is created using the v2 cli targeted at a kilo server:

 $ glance --os-image-api-version 2 image-create --disk-format raw --container-format bare
 +------------------+--------------------------------------+
 | Property | Value |
 +------------------+--------------------------------------+
 | checksum | None |
 | container_format | bare |
 | created_at | 2015-09-14T17:12:33Z |
 | disk_format | raw |
 | id | 898cb887-bb04-41e0-98d1-7a76f389760b |
 | min_disk | 0 |
 | min_ram | 0 |
 | name | None |
 | owner | 0d1e2841f77e4936816d93e6cf252098 |
 | protected | False |
 | size | None |
 | status | queued |
 | tags | [] |
 | updated_at | 2015-09-14T17:12:33Z |
 | virtual_size | None |
 | visibility | private |
 +------------------+--------------------------------------+

listing with human readable produces the following error

 $ glance --os-image-api-version 1 image-list --human-readable
 float argument required, not NoneType

$ glance --debug --os-image-api-version 1 image-list --human-readable
curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'User-Agent: python-glanceclient' -H 'Connection: keep-alive' -H 'X-Auth-Token: {SHA1}d87b9a1a03fa8906fab27558aae2f6727fe5e063' -H 'Content-Type: application/octet-stream' http://10.0.0.85:9292/v1/images/detail?sort_key=name&sort_dir=asc&limit=20

HTTP/1.1 200 OK
date: Mon, 14 Sep 2015 17:14:33 GMT
connection: keep-alive
content-type: application/json; charset=UTF-8
content-length: 897
x-openstack-request-id: req-req-1c04d92c-f838-456d-a2fe-4327bb915823

{"images": [{"status": "queued", "deleted_at": null, "name": null, "deleted": false, "container_format": "bare", "created_at": "2015-09-14T17:12:16.000000", "disk_format": "raw", "updated_at": "2015-09-14T17:12:16.000000", "min_disk": 0, "protected": false, "id": "b4830564-493f-4091-9fc8-54ac9e34f65e", "min_ram": 0, "checksum": null, "owner": "0d1e2841f77e4936816d93e6cf252098", "is_public": false, "virtual_size": null, "properties": {}, "size": 0}, {"status": "queued", "deleted_at": null, "name": null, "deleted": false, "container_format": "bare", "created_at": "2015-09-14T17:12:33.000000", "disk_format": "raw", "updated_at": "2015-09-14T17:12:33.000000", "min_disk": 0, "protected": false, "id": "898cb887-bb04-41e0-98d1-7a76f389760b", "min_ram": 0, "checksum": null, "owner": "0d1e2841f77e4936816d93e6cf252098", "is_public": false, "virtual_size": null, "properties": {}, "size": null}]}

Traceback (most recent call last):
  File "/mnt/sam/git/python-glanceclient/glanceclient/shell.py", line 700, in main
    args.func(client, args)
  File "/mnt/sam/git/python-glanceclient/glanceclient/v1/shell.py", line 123, in do_image_list
    utils.print_list(images, columns)
  File "/mnt/sam/git/python-glanceclient/glanceclient/common/utils.py", line 183, in print_list
    for o in objs:
  File "/mnt/sam/git/python-glanceclient/glanceclient/v1/shell.py", line 119, in <genexpr>
    images = (convert_size(image) for image in images)
  File "/mnt/sam/git/python-glanceclient/glanceclient/v1/shell.py", line 116, in convert_size
    image.size = utils.make_size_human_readable(image.size)
  File "/mnt/sam/git/python-glanceclient/glanceclient/common/utils.py", line 315, in make_size_human_readable
    padded = '%.1f' % size
TypeError: float argument required, not NoneType
float argument required, not NoneType

Changed in python-glanceclient:
assignee: nobody → Stuart McLaren (stuart-mclaren)

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

Changed in python-glanceclient:
status: New → In Progress

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

commit 3d3d8296c490caa4d1f3a0607818a9c2af752233
Author: Stuart McLaren <email address hidden>
Date: Mon Sep 14 17:27:43 2015 +0000

    Fix human readable when size is None

    If an image size is null don't stack trace when listing.

    Change-Id: Iba18470edbe032d1d01380372d57fa17adef5f7e
    Closes-bug: 1495632

Changed in python-glanceclient:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/228394
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=e895e1a6b1c17f18f254a8c32dba2195302edfcd
Submitter: Jenkins
Branch: stable/liberty

commit e895e1a6b1c17f18f254a8c32dba2195302edfcd
Author: Stuart McLaren <email address hidden>
Date: Mon Sep 14 17:27:43 2015 +0000

    Fix human readable when size is None

    If an image size is null don't stack trace when listing.

    Change-Id: Iba18470edbe032d1d01380372d57fa17adef5f7e
    Closes-bug: 1495632
    (cherry picked from commit 3d3d8296c490caa4d1f3a0607818a9c2af752233)

Changed in python-glanceclient:
milestone: none → 1.2.0
status: Fix Committed → Fix Released

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

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

Other bug subscribers