Fix server list error with --long and -c options
Using options --long and -c and specifying same columns added by --long option, it passes duplicated column names to prettytable and report the following error: Field names must be unique! This patch removes duplicated columns. Change-Id: I9c0bd09c50dac568ca1980a6b53a6c544b85c2aa
This commit is contained in:
parent
b52ae93cd2
commit
794334ec24
@ -2586,9 +2586,9 @@ class ListServer(command.Lister):
|
|||||||
columns += ('Metadata',)
|
columns += ('Metadata',)
|
||||||
column_headers += ('Properties',)
|
column_headers += ('Properties',)
|
||||||
|
|
||||||
# convert back to tuple
|
# remove duplicates
|
||||||
column_headers = tuple(column_headers)
|
column_headers = tuple(dict.fromkeys(column_headers))
|
||||||
columns = tuple(columns)
|
columns = tuple(dict.fromkeys(columns))
|
||||||
|
|
||||||
if parsed_args.marker is not None:
|
if parsed_args.marker is not None:
|
||||||
# Check if both "--marker" and "--deleted" are used.
|
# Check if both "--marker" and "--deleted" are used.
|
||||||
|
@ -4706,6 +4706,7 @@ class TestServerList(_TestServerList):
|
|||||||
self.assertIn('Availability Zone', columns)
|
self.assertIn('Availability Zone', columns)
|
||||||
self.assertIn('Host', columns)
|
self.assertIn('Host', columns)
|
||||||
self.assertIn('Properties', columns)
|
self.assertIn('Properties', columns)
|
||||||
|
self.assertCountEqual(columns, set(columns))
|
||||||
|
|
||||||
def test_server_list_no_name_lookup_option(self):
|
def test_server_list_no_name_lookup_option(self):
|
||||||
self.data = tuple(
|
self.data = tuple(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user