image list pages even when output is not a tty

Bug #1570592 reported by Clark Boylan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Confirmed
Undecided
Unassigned

Bug Description

openstack image client pages its output even when the output of the command is not a tty. This means that scripts operating on an image list may not get a complete list of images.

To reproduce:
$ venv-openstack/bin/openstack --version
openstack 2.3.0
$ venv-openstack/bin/glance --version
2.0.0
$ OS_CLIENT_CONFIG_FILE=/etc/openstack/all-clouds.yaml venv-openstack/bin/openstack --os-cloud openstackjenkins-vexxhost image list | wc -l
29
$ OS_CLIENT_CONFIG_FILE=/etc/openstack/all-clouds.yaml venv-openstack/bin/openstack --os-cloud openstackjenkins-vexxhost image list --limit 500 | wc -l
47

Notice that the total number of lines changes when it should be constant because the output is a pipe. This was also observed when redirecting output to a normal file.

Revision history for this message
Ryan Selden (ryanx-seldon) wrote :

I reproduced by adding tons of images:
`openstack image create 1`
`openstack image create 2`
... (a bunch of times)

And then ran
`openstack image list | wc -l`
and
`openstack image-list --limit 500 | wc -l`

(The --limit 500 is to force osc to show all images (I don't have more than 500), ie making the first page show everything)
The outputs are indeed, different.

Changed in python-openstackclient:
status: New → Confirmed
Revision history for this message
Ryan Selden (ryanx-seldon) wrote :

The problem with fixing it is that glance has configuration fields for the default limit and the maximum number of images that can be returned in a request. Realistically this issue is going to have to be fixed by each individual script that wants to use it (they would have to check if they've seen all images, and then query for another page if needed). Not sure there would be a clean fix in this client, but I'll let others comment.

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.