Add some fields back to bay_list

The fields 'master_count', 'node_count', and 'status' were accidently
removed in previous patch [1]. This commit added it back.

[1] https://review.openstack.org/#/c/317268/

Change-Id: I9f75062af90f46d5868a5473fb83daa9a725fc95
This commit is contained in:
Hongbin Lu 2016-05-18 17:10:20 -05:00
parent 68e301fc8d
commit 66b566a196
2 changed files with 8 additions and 7 deletions

View File

@ -53,13 +53,14 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
def test_bay_list_ignored_duplicated_field(self, mock_list):
mock_list.return_value = [FakeBay()]
self._test_arg_success('bay-list --fields status,status,status,name',
keyword='\n| uuid | name | Status |\n')
keyword=('\n| uuid | name | node_count | '
'master_count | status |\n'))
# Output should be
# +------+------+--------+
# | uuid | name | Status |
# +------+------+--------+
# | x | x | x |
# +------+------+--------+
# +------+------+------------+--------------+--------+
# | uuid | name | node_count | master_count | status |
# +------+------+------------+--------------+--------+
# | x | x | x | x | x |
# +------+------+------------+--------------+--------+
self.assertTrue(mock_list.called)
@mock.patch('magnumclient.v1.bays.BayManager.list')

View File

@ -51,7 +51,7 @@ def do_bay_list(cs, args):
bays = cs.bays.list(marker=args.marker, limit=args.limit,
sort_key=args.sort_key,
sort_dir=args.sort_dir)
columns = ['uuid', 'name']
columns = ['uuid', 'name', 'node_count', 'master_count', 'status']
columns += utils._get_list_table_columns_and_formatters(
args.fields, bays,
exclude_fields=(c.lower() for c in columns))[0]