Filter images list by public=True|False

When running the image-list command the user should have the option
to list images according to whether or not the image is was set
to public.  A new test is included to verify this behavior.

Change-Id: If645e7390fcf850648cda780a04ea37a26d855a2
Fixes bug: 1118799
This commit is contained in:
John Bresnahan
2013-03-12 14:24:58 -10:00
parent c7c8e92e3c
commit a8f7de2afd
2 changed files with 53 additions and 1 deletions
+4 -1
View File
@@ -62,10 +62,13 @@ DISK_FORMATS = ('Acceptable formats: ami, ari, aki, vhd, vmdk, raw, '
@utils.arg('--sort-dir', default='asc',
choices=glanceclient.v1.images.SORT_DIR_VALUES,
help='Sort image list in specified direction.')
@utils.arg('--is-public', type=utils.string_to_bool, metavar='{True|False}',
help=('Allows the user to select a listing of public or non '
'public images.'))
def do_image_list(gc, args):
"""List images you can access."""
filter_keys = ['name', 'status', 'container_format', 'disk_format',
'size_min', 'size_max']
'size_min', 'size_max', 'is_public']
filter_items = [(key, getattr(args, key)) for key in filter_keys]
filters = dict([item for item in filter_items if item[1] is not None])