Skip to content

Commit

Permalink
Suppress pagination on non-tty glance index.
Browse files Browse the repository at this point in the history
Fixes bug 978610.

Avoid the 'Fetch next page? [Y/n]' prompt interfering with
redirected output.

The native glance CLI will soon be superceeded by the new
python-glanceclient, however this patch could still be useful
to propogate from master to the stable diablo/essex branches.

Change-Id: I16bc6156d7c7e9ed27aabcaa51211060ec24a824
  • Loading branch information
Eoghan Glynn committed Apr 13, 2012
1 parent 05a6124 commit 0e10519
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/glance
Expand Up @@ -516,7 +516,11 @@ def _images_index(client, filters, limit, print_header=False, **kwargs):
image['container_format'],
image['size'])

if not options.force and len(images) == limit and \
# suppress pagination when output is redirected
suppress_pagination = (options.force or
(getattr(os, 'isatty') and not os.isatty(sys.stdout.fileno())))

if not suppress_pagination and len(images) == limit and \
not user_confirm("Fetch next page?", True):
return SUCCESS

Expand Down

0 comments on commit 0e10519

Please sign in to comment.