diff --git a/setup.cfg b/setup.cfg index 4127a86c..43715778 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,6 +64,7 @@ openstack.container.v1 = appcontainer_network_attach = zunclient.osc.v1.containers:NetworkAttach appcontainer_image_search = zunclient.osc.v1.images:SearchImage appcontainer_remove_security_group = zunclient.osc.v1.containers:RemoveSecurityGroup + appcontainer_image_show = zunclient.osc.v1.images:ShowImage [build_sphinx] source-dir = doc/source diff --git a/zunclient/osc/v1/images.py b/zunclient/osc/v1/images.py index 2ca76b99..7c3a1320 100644 --- a/zunclient/osc/v1/images.py +++ b/zunclient/osc/v1/images.py @@ -119,3 +119,25 @@ class SearchImage(command.Lister): columns = ('ID', 'Name', 'Tags', 'Status', 'Size', 'Metadata') return (columns, (utils.get_item_properties(image, columns) 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='', + 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)