Skip to content

Commit 7ba7384

Browse files
author
Tang Chen
committed
Use _get_columns() to obtain columns in network.py
Objects returned by Network v2 and Compute v2 are different. When getting columns to display, Network v2 uses obj.keys(), while Compute v2 uses obj._info.keys(). But both of them could obtain the keys of the object by _get_columns(). Change-Id: I347815f2d28822a95bd6f57d429b84b7ca96e0ee
1 parent 0b2c4b1 commit 7ba7384

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

openstackclient/network/v2/network.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def take_action_network(self, client, parsed_args):
162162
def take_action_compute(self, client, parsed_args):
163163
attrs = _get_attrs_compute(self.app.client_manager, parsed_args)
164164
obj = client.networks.create(**attrs)
165-
columns = tuple(sorted(obj._info.keys()))
165+
columns = _get_columns(obj._info)
166166
data = utils.get_dict_properties(obj._info, columns)
167167
return (columns, data)
168168

@@ -359,10 +359,10 @@ def take_action_network(self, client, parsed_args):
359359
return (columns, data)
360360

361361
def take_action_compute(self, client, parsed_args):
362-
network = utils.find_resource(
362+
obj = utils.find_resource(
363363
client.networks,
364364
parsed_args.network,
365365
)
366-
columns = sorted(network._info.keys())
367-
data = utils.get_dict_properties(network._info, columns)
366+
columns = _get_columns(obj._info)
367+
data = utils.get_dict_properties(obj._info, columns)
368368
return (columns, data)

0 commit comments

Comments
 (0)