Don't use human readable heading labels in tables
This is in line with what other OS clients do. Fixes: bug #1160689 Change-Id: Icbf053bd93ecdbeeb2ea791c32199225803d09be
This commit is contained in:
@@ -39,7 +39,8 @@ def pretty_choice_list(l):
|
||||
return ', '.join("'%s'" % i for i in l)
|
||||
|
||||
|
||||
def print_list(objs, fields, field_labels, formatters={}, sortby=0):
|
||||
def print_list(objs, fields, field_labels=None, formatters={}, sortby=0):
|
||||
field_labels = field_labels or fields
|
||||
pt = prettytable.PrettyTable([f for f in field_labels], caching=False)
|
||||
pt.align = 'l'
|
||||
|
||||
|
||||
@@ -182,9 +182,8 @@ def do_stack_list(hc, args={}):
|
||||
'''List the user's stacks'''
|
||||
kwargs = {}
|
||||
stacks = hc.stacks.list(**kwargs)
|
||||
field_labels = ['ID', 'Name', 'Status', 'Created']
|
||||
fields = ['id', 'stack_name', 'stack_status', 'creation_time']
|
||||
utils.print_list(stacks, fields, field_labels, sortby=3)
|
||||
utils.print_list(stacks, fields, sortby=3)
|
||||
|
||||
|
||||
@utils.arg('id', metavar='<NAME or ID>',
|
||||
@@ -247,11 +246,9 @@ def do_resource_list(hc, args):
|
||||
except exc.HTTPNotFound:
|
||||
raise exc.CommandError('Stack not found: %s' % args.id)
|
||||
else:
|
||||
field_labels = ['Name', 'Type',
|
||||
'Status', 'Updated']
|
||||
fields = ['logical_resource_id', 'resource_type',
|
||||
'resource_status', 'updated_time']
|
||||
utils.print_list(resources, fields, field_labels, sortby=3)
|
||||
utils.print_list(resources, fields, sortby=3)
|
||||
|
||||
|
||||
@utils.arg('id', metavar='<NAME or ID>',
|
||||
@@ -316,11 +313,9 @@ def do_event_list(hc, args):
|
||||
except exc.HTTPNotFound:
|
||||
raise exc.CommandError('Stack not found: %s' % args.id)
|
||||
else:
|
||||
field_labels = ['Resource', 'ID', 'Reason',
|
||||
'Status', 'Event time']
|
||||
fields = ['logical_resource_id', 'id', 'resource_status_reason',
|
||||
'resource_status', 'event_time']
|
||||
utils.print_list(events, fields, field_labels, sortby=4)
|
||||
utils.print_list(events, fields, sortby=4)
|
||||
|
||||
|
||||
@utils.arg('id', metavar='<NAME or ID>',
|
||||
|
||||
@@ -215,9 +215,9 @@ class ShellTest(TestCase):
|
||||
list_text = self.shell('list')
|
||||
|
||||
required = [
|
||||
'ID',
|
||||
'Status',
|
||||
'Created',
|
||||
'id',
|
||||
'stack_status',
|
||||
'creation_time',
|
||||
'teststack',
|
||||
'1',
|
||||
'CREATE_COMPLETE',
|
||||
@@ -282,8 +282,8 @@ class ShellTest(TestCase):
|
||||
'LinuxDistribution=F17"' % template_file)
|
||||
|
||||
required = [
|
||||
'Name',
|
||||
'ID',
|
||||
'stack_name',
|
||||
'id',
|
||||
'teststack',
|
||||
'1'
|
||||
]
|
||||
@@ -313,8 +313,8 @@ class ShellTest(TestCase):
|
||||
'LinuxDistribution=F17"')
|
||||
|
||||
required = [
|
||||
'Name',
|
||||
'ID',
|
||||
'stack_name',
|
||||
'id',
|
||||
'teststack2',
|
||||
'2'
|
||||
]
|
||||
@@ -350,8 +350,8 @@ class ShellTest(TestCase):
|
||||
'LinuxDistribution=F17"')
|
||||
|
||||
required = [
|
||||
'Name',
|
||||
'ID',
|
||||
'stack_name',
|
||||
'id',
|
||||
'teststack2',
|
||||
'2'
|
||||
]
|
||||
@@ -380,8 +380,8 @@ class ShellTest(TestCase):
|
||||
'LinuxDistribution=F17"' % template_file)
|
||||
|
||||
required = [
|
||||
'Name',
|
||||
'ID',
|
||||
'stack_name',
|
||||
'id',
|
||||
'teststack2',
|
||||
'1'
|
||||
]
|
||||
@@ -405,8 +405,8 @@ class ShellTest(TestCase):
|
||||
create_text = self.shell('delete teststack2/2')
|
||||
|
||||
required = [
|
||||
'Name',
|
||||
'ID',
|
||||
'stack_name',
|
||||
'id',
|
||||
'teststack',
|
||||
'1'
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user