Use cliff formattable columns in object storage commands

Partial-Bug: #1687955
Partially implement blueprint osc-formattable-columns

Change-Id: I65737561c9b5ef29f5878316d2ff89f3d538158f
This commit is contained in:
Akihiro Motoki 2017-05-15 04:01:07 +00:00 committed by Dean Troyer
parent 1a21f02bc7
commit c2630ae91a
3 changed files with 7 additions and 4 deletions

View File

@ -13,9 +13,9 @@
"""Account v1 action implementations""" """Account v1 action implementations"""
from osc_lib.cli import format_columns
from osc_lib.cli import parseractions from osc_lib.cli import parseractions
from osc_lib.command import command from osc_lib.command import command
from osc_lib import utils
import six import six
from openstackclient.i18n import _ from openstackclient.i18n import _
@ -48,7 +48,8 @@ class ShowAccount(command.ShowOne):
def take_action(self, parsed_args): def take_action(self, parsed_args):
data = self.app.client_manager.object_store.account_show() data = self.app.client_manager.object_store.account_show()
if 'properties' in data: if 'properties' in data:
data['properties'] = utils.format_dict(data.pop('properties')) data['properties'] = format_columns.DictColumn(
data.pop('properties'))
return zip(*sorted(six.iteritems(data))) return zip(*sorted(six.iteritems(data)))

View File

@ -17,6 +17,7 @@
import logging import logging
from osc_lib.cli import format_columns
from osc_lib.cli import parseractions from osc_lib.cli import parseractions
from osc_lib.command import command from osc_lib.command import command
from osc_lib import utils from osc_lib import utils
@ -230,7 +231,7 @@ class ShowContainer(command.ShowOne):
container=parsed_args.container, container=parsed_args.container,
) )
if 'properties' in data: if 'properties' in data:
data['properties'] = utils.format_dict(data.pop('properties')) data['properties'] = format_columns.DictColumn(data['properties'])
return zip(*sorted(six.iteritems(data))) return zip(*sorted(six.iteritems(data)))

View File

@ -17,6 +17,7 @@
import logging import logging
from osc_lib.cli import format_columns
from osc_lib.cli import parseractions from osc_lib.cli import parseractions
from osc_lib.command import command from osc_lib.command import command
from osc_lib import exceptions from osc_lib import exceptions
@ -284,7 +285,7 @@ class ShowObject(command.ShowOne):
object=parsed_args.object, object=parsed_args.object,
) )
if 'properties' in data: if 'properties' in data:
data['properties'] = utils.format_dict(data.pop('properties')) data['properties'] = format_columns.DictColumn(data['properties'])
return zip(*sorted(six.iteritems(data))) return zip(*sorted(six.iteritems(data)))