Fix show info about share network

Add check for _info dict, without this check an exception will occur and user doesn't get info.

Closes-Bug:#2065771
Change-Id: I0b0dba95c53aad264921dc32644ee8e5b86fc1e2
This commit is contained in:
morozovalekseywot 2024-05-15 20:13:38 +03:00 committed by Morozov Aleksey
parent 56ba694486
commit 48fbad6f62

@ -211,6 +211,8 @@ class ShowShareNetwork(command.ShowOne):
parsed_args.share_network) parsed_args.share_network)
data = share_network._info data = share_network._info
if 'share_network_subnets' not in data:
data['share_network_subnets'] = []
# Special mapping for columns to make the output easier to read: # Special mapping for columns to make the output easier to read:
# 'metadata' --> 'properties' # 'metadata' --> 'properties'
@ -316,6 +318,8 @@ class CreateShareNetwork(command.ShowOne):
availability_zone=availability_zone, availability_zone=availability_zone,
) )
share_network_data = share_network._info share_network_data = share_network._info
if 'share_network_subnets' not in share_network_data:
share_network_data['share_network_subnets'] = []
share_network_data.pop('links', None) share_network_data.pop('links', None)
if parsed_args.formatter == 'table': if parsed_args.formatter == 'table':
share_network_data['share_network_subnets'] = ( share_network_data['share_network_subnets'] = (