Merge "Add some fields back to bay_list"

This commit is contained in:
Jenkins
2016-05-23 10:26:40 +00:00
committed by Gerrit Code Review
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]