Update zunclient about image_search
Add parameter to supporting search image accurately Change-Id: I72630689913a5d656b98f350453de3a4e3e5660f Signed-off-by: pengdake <19921207pq@gmail.com>
This commit is contained in:
parent
2f77408bcf
commit
755f0a3508
@ -107,6 +107,11 @@ class SearchImage(command.Lister):
|
|||||||
'image_name',
|
'image_name',
|
||||||
metavar='<image_name>',
|
metavar='<image_name>',
|
||||||
help='Name of the image')
|
help='Name of the image')
|
||||||
|
parser.add_argument(
|
||||||
|
'--exact-match',
|
||||||
|
default=False,
|
||||||
|
action='store_true',
|
||||||
|
help='exact match image name')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -114,6 +119,7 @@ class SearchImage(command.Lister):
|
|||||||
opts = {}
|
opts = {}
|
||||||
opts['image_driver'] = parsed_args.image_driver
|
opts['image_driver'] = parsed_args.image_driver
|
||||||
opts['image'] = parsed_args.image_name
|
opts['image'] = parsed_args.image_name
|
||||||
|
opts['exact_match'] = parsed_args.exact_match
|
||||||
opts = zun_utils.remove_null_parms(**opts)
|
opts = zun_utils.remove_null_parms(**opts)
|
||||||
images = client.images.search_image(**opts)
|
images = client.images.search_image(**opts)
|
||||||
columns = ('ID', 'Name', 'Tags', 'Status', 'Size', 'Metadata')
|
columns = ('ID', 'Name', 'Tags', 'Status', 'Size', 'Metadata')
|
||||||
|
@ -16,7 +16,7 @@ from zunclient import exceptions
|
|||||||
|
|
||||||
|
|
||||||
PULL_ATTRIBUTES = ['repo']
|
PULL_ATTRIBUTES = ['repo']
|
||||||
IMAGE_SEARCH_ATTRIBUTES = ['image', 'image_driver']
|
IMAGE_SEARCH_ATTRIBUTES = ['image', 'image_driver', 'exact_match']
|
||||||
|
|
||||||
|
|
||||||
class Image(base.Resource):
|
class Image(base.Resource):
|
||||||
|
@ -73,11 +73,16 @@ def do_image_show(cs, args):
|
|||||||
metavar='<image-driver>',
|
metavar='<image-driver>',
|
||||||
choices=['glance', 'docker'],
|
choices=['glance', 'docker'],
|
||||||
help='Name of the image driver (glance, docker)')
|
help='Name of the image driver (glance, docker)')
|
||||||
|
@utils.arg('--exact-match',
|
||||||
|
default=False,
|
||||||
|
action='store_true',
|
||||||
|
help='exact match image name')
|
||||||
def do_image_search(cs, args):
|
def do_image_search(cs, args):
|
||||||
"""Print list of available images from repository based on user query."""
|
"""Print list of available images from repository based on user query."""
|
||||||
opts = {}
|
opts = {}
|
||||||
opts['image'] = args.image
|
opts['image'] = args.image
|
||||||
opts['image_driver'] = args.image_driver
|
opts['image_driver'] = args.image_driver
|
||||||
|
opts['exact_match'] = args.exact_match
|
||||||
images = cs.images.search_image(**opts)
|
images = cs.images.search_image(**opts)
|
||||||
columns = ('ID', 'Name', 'Tags', 'Status', 'Size', 'Metadata')
|
columns = ('ID', 'Name', 'Tags', 'Status', 'Size', 'Metadata')
|
||||||
utils.print_list(images, columns,
|
utils.print_list(images, columns,
|
||||||
|
Loading…
Reference in New Issue
Block a user