Add image show for openstackclient

Closes-Bug: #1751428

Change-Id: Ibfeb0765fa9dc06ef78699dc91fbbf83f31c4ed5
Signed-off-by: pengdake <19921207pq@gmail.com>
This commit is contained in:
pengdake 2018-02-02 07:48:37 +08:00
parent 2f77408bcf
commit 29ac0b0077
2 changed files with 23 additions and 0 deletions

View File

@ -64,6 +64,7 @@ openstack.container.v1 =
appcontainer_network_attach = zunclient.osc.v1.containers:NetworkAttach appcontainer_network_attach = zunclient.osc.v1.containers:NetworkAttach
appcontainer_image_search = zunclient.osc.v1.images:SearchImage appcontainer_image_search = zunclient.osc.v1.images:SearchImage
appcontainer_remove_security_group = zunclient.osc.v1.containers:RemoveSecurityGroup appcontainer_remove_security_group = zunclient.osc.v1.containers:RemoveSecurityGroup
appcontainer_image_show = zunclient.osc.v1.images:ShowImage
[build_sphinx] [build_sphinx]
source-dir = doc/source source-dir = doc/source

View File

@ -119,3 +119,25 @@ class SearchImage(command.Lister):
columns = ('ID', 'Name', 'Tags', 'Status', 'Size', 'Metadata') columns = ('ID', 'Name', 'Tags', 'Status', 'Size', 'Metadata')
return (columns, (utils.get_item_properties(image, columns) return (columns, (utils.get_item_properties(image, columns)
for image in images)) for image in images))
class ShowImage(command.ShowOne):
"""Describe a specific image"""
log = logging.getLogger(__name__ + ".ShowImage")
def get_parser(self, prog_name):
parser = super(ShowImage, self).get_parser(prog_name)
parser.add_argument(
'uuid',
metavar='<uuid>',
help='UUID of image to describe')
return parser
def take_action(self, parsed_args):
client = _get_client(self, parsed_args)
opts = {}
opts['id'] = parsed_args.uuid
image = client.images.get(**opts)
columns = _image_columns(image)
return columns, utils.get_item_properties(image, columns)