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
This commit is contained in:
parent
0b2c4b1f32
commit
7ba73845c1
@ -162,7 +162,7 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
|
||||
def take_action_compute(self, client, parsed_args):
|
||||
attrs = _get_attrs_compute(self.app.client_manager, parsed_args)
|
||||
obj = client.networks.create(**attrs)
|
||||
columns = tuple(sorted(obj._info.keys()))
|
||||
columns = _get_columns(obj._info)
|
||||
data = utils.get_dict_properties(obj._info, columns)
|
||||
return (columns, data)
|
||||
|
||||
@ -359,10 +359,10 @@ class ShowNetwork(common.NetworkAndComputeShowOne):
|
||||
return (columns, data)
|
||||
|
||||
def take_action_compute(self, client, parsed_args):
|
||||
network = utils.find_resource(
|
||||
obj = utils.find_resource(
|
||||
client.networks,
|
||||
parsed_args.network,
|
||||
)
|
||||
columns = sorted(network._info.keys())
|
||||
data = utils.get_dict_properties(network._info, columns)
|
||||
columns = _get_columns(obj._info)
|
||||
data = utils.get_dict_properties(obj._info, columns)
|
||||
return (columns, data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user