Add status column for "openstack image list"
Actually, the status column is useful for the user. So, it`s better to output this info by default (or, user had to specify the extra option, i.e. --long). Change-Id: Id2a9f86f0de5310f8f5ff9a46bf1b7411094b519 Closes-Bug: #1519181
This commit is contained in:
parent
27869c0f3f
commit
342fd158e9
openstackclient
@ -354,7 +354,12 @@ class ListImage(lister.Lister):
|
||||
kwargs['public'] = True
|
||||
if parsed_args.private:
|
||||
kwargs['private'] = True
|
||||
kwargs['detailed'] = bool(parsed_args.property or parsed_args.long)
|
||||
# Note: We specifically need to do that below to get the 'status'
|
||||
# column.
|
||||
#
|
||||
# Always set kwargs['detailed'] to True, and then filter the columns
|
||||
# according to whether the --long option is specified or not.
|
||||
kwargs['detailed'] = True
|
||||
|
||||
if parsed_args.long:
|
||||
columns = (
|
||||
@ -382,7 +387,7 @@ class ListImage(lister.Lister):
|
||||
'Properties',
|
||||
)
|
||||
else:
|
||||
columns = ("ID", "Name")
|
||||
columns = ("ID", "Name", "Status")
|
||||
column_headers = columns
|
||||
|
||||
# List of image data received
|
||||
|
@ -417,7 +417,7 @@ class ListImage(lister.Lister):
|
||||
'Tags',
|
||||
)
|
||||
else:
|
||||
columns = ("ID", "Name")
|
||||
columns = ("ID", "Name", "Status")
|
||||
column_headers = columns
|
||||
|
||||
# List of image data received
|
||||
|
@ -261,16 +261,17 @@ class TestImageList(TestImage):
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.api_mock.image_list.assert_called_with(
|
||||
detailed=False,
|
||||
detailed=True,
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -288,17 +289,18 @@ class TestImageList(TestImage):
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.api_mock.image_list.assert_called_with(
|
||||
detailed=False,
|
||||
detailed=True,
|
||||
public=True,
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -316,17 +318,18 @@ class TestImageList(TestImage):
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.api_mock.image_list.assert_called_with(
|
||||
detailed=False,
|
||||
detailed=True,
|
||||
private=True,
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -401,12 +404,13 @@ class TestImageList(TestImage):
|
||||
property_field='properties',
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(columns, collist)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -423,7 +427,7 @@ class TestImageList(TestImage):
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.api_mock.image_list.assert_called_with(
|
||||
detailed=False,
|
||||
detailed=True,
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
si_mock.assert_called_with(
|
||||
@ -431,12 +435,13 @@ class TestImageList(TestImage):
|
||||
'name:asc'
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
|
@ -374,12 +374,13 @@ class TestImageList(TestImage):
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -402,12 +403,13 @@ class TestImageList(TestImage):
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -430,12 +432,13 @@ class TestImageList(TestImage):
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -458,12 +461,13 @@ class TestImageList(TestImage):
|
||||
marker=image_fakes.image_id,
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(columns, collist)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -536,12 +540,13 @@ class TestImageList(TestImage):
|
||||
property_field='properties',
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(columns, collist)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
@ -565,12 +570,13 @@ class TestImageList(TestImage):
|
||||
'name:asc'
|
||||
)
|
||||
|
||||
collist = ('ID', 'Name')
|
||||
collist = ('ID', 'Name', 'Status')
|
||||
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
image_fakes.image_id,
|
||||
image_fakes.image_name
|
||||
image_fakes.image_name,
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user