Return the `port
` column headers expected in the list command
In [1], it was added the ability to print in the "port list" command any field not defined in the hardcoded column set for this command. But in [2], it was added a filter list in the API call in order to reduce the CLI execution time. The unintentional drawback of this optimization was that is no longer possible to print any field outside the "port list" column set. Because the optimization if preferred and it is always possible to use "port show" to see all the port fields, the code added in [1] is removed. [1]https://review.opendev.org/c/openstack/python-openstackclient/+/522901 [2]https://review.opendev.org/c/openstack/python-openstackclient/+/754117 Closes-Bug: #2098980 Related-Bug: #1707848 Related-Bug: #1897100 Change-Id: Ia944b8e108c454219d642cfa595ffafdf060a57f
This commit is contained in:
parent
2e5a830276
commit
4dbfc47552
openstackclient
@ -944,15 +944,12 @@ class ListPort(command.Lister):
|
||||
for item in columns
|
||||
]
|
||||
|
||||
headers, attrs = utils.calculate_header_and_attrs(
|
||||
column_headers, columns, parsed_args
|
||||
)
|
||||
return (
|
||||
headers,
|
||||
column_headers,
|
||||
(
|
||||
utils.get_item_properties(
|
||||
s,
|
||||
attrs,
|
||||
columns,
|
||||
formatters=_list_formatters,
|
||||
)
|
||||
for s in data
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from tempest.lib import exceptions as tempest_exc
|
||||
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
@ -162,8 +164,16 @@ class PortTests(common.NetworkTagTests):
|
||||
id_list = [p['ID'] for p in json_output]
|
||||
self.assertIn(id1, id_list)
|
||||
self.assertIn(id2, id_list)
|
||||
# Check an unknown field exists
|
||||
self.assertIn('device_id', json_output[0])
|
||||
# Check an unknown field does not exist
|
||||
self.assertNotIn('device_id', json_output[0])
|
||||
|
||||
# Test list with only unknown fields
|
||||
exc = self.assertRaises(
|
||||
tempest_exc.CommandFailed,
|
||||
self.openstack,
|
||||
'port list -c device_id',
|
||||
)
|
||||
self.assertIn("No recognized column names in ['device_id']", str(exc))
|
||||
|
||||
def test_port_set(self):
|
||||
"""Test create, set, show, delete"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user