diff --git a/manilaclient/osc/v2/share_network_subnets.py b/manilaclient/osc/v2/share_network_subnets.py index 8500615cc..4ae099da9 100644 --- a/manilaclient/osc/v2/share_network_subnets.py +++ b/manilaclient/osc/v2/share_network_subnets.py @@ -19,6 +19,7 @@ from osc_lib import utils as oscutils from manilaclient import api_versions from manilaclient.common._i18n import _ +from manilaclient.common import cliutils LOG = logging.getLogger(__name__) @@ -113,6 +114,15 @@ class CreateShareNetworkSubnet(command.ShowOne): share_network_id=share_network_id) ) subnet_data = subnet_create_check[1] + if subnet_data: + if parsed_args.formatter == 'table': + for k, v in subnet_data.items(): + if isinstance(v, dict): + capabilities_list = [v] + dict_values = cliutils.convert_dict_list_to_string( + capabilities_list + ) + subnet_data[k] = dict_values else: share_network_subnet = share_client.share_network_subnets.create( neutron_net_id=parsed_args.neutron_net_id, diff --git a/manilaclient/tests/functional/osc/test_share_network_subnets.py b/manilaclient/tests/functional/osc/test_share_network_subnets.py index 672fce09d..7f00c449d 100644 --- a/manilaclient/tests/functional/osc/test_share_network_subnets.py +++ b/manilaclient/tests/functional/osc/test_share_network_subnets.py @@ -25,7 +25,7 @@ class ShareNetworkSubnetsCLITest(base.OSCClientTestBase): share_network['id']) self.assertEqual('True', check_result['compatible']) - self.assertEqual('{}', check_result['hosts_check_result']) + self.assertEqual('', check_result['hosts_check_result']) def test_openstack_share_network_create_check_restart(self): share_network = self.create_share_network() @@ -34,4 +34,4 @@ class ShareNetworkSubnetsCLITest(base.OSCClientTestBase): share_network['id'], restart_check=True) self.assertEqual('True', check_result['compatible']) - self.assertEqual('{}', check_result['hosts_check_result']) + self.assertEqual('', check_result['hosts_check_result']) diff --git a/releasenotes/notes/bug-1989818-fix-share-network-output-format-93d997f0f4a33fab.yaml b/releasenotes/notes/bug-1989818-fix-share-network-output-format-93d997f0f4a33fab.yaml new file mode 100644 index 000000000..fa6229a5f --- /dev/null +++ b/releasenotes/notes/bug-1989818-fix-share-network-output-format-93d997f0f4a33fab.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The format of the osc share network subnet create command output has been + updated to return a list of hosts instead of a dictionary, as we do for + other commands in the client.