Merge "[OSC] Fix output format for osc share subnet create"

This commit is contained in:
Zuul 2024-03-04 18:19:29 +00:00 committed by Gerrit Code Review
commit 5907822db6
3 changed files with 18 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from osc_lib import utils as oscutils
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.common._i18n import _ from manilaclient.common._i18n import _
from manilaclient.common import cliutils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -135,6 +136,15 @@ class CreateShareNetworkSubnet(command.ShowOne):
share_network_id=share_network_id) share_network_id=share_network_id)
) )
subnet_data = subnet_create_check[1] 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: else:
share_network_subnet = share_client.share_network_subnets.create( share_network_subnet = share_client.share_network_subnets.create(
neutron_net_id=parsed_args.neutron_net_id, neutron_net_id=parsed_args.neutron_net_id,

View File

@ -25,7 +25,7 @@ class ShareNetworkSubnetsCLITest(base.OSCClientTestBase):
share_network['id']) share_network['id'])
self.assertEqual('True', check_result['compatible']) 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): def test_openstack_share_network_create_check_restart(self):
share_network = self.create_share_network() share_network = self.create_share_network()
@ -34,4 +34,4 @@ class ShareNetworkSubnetsCLITest(base.OSCClientTestBase):
share_network['id'], restart_check=True) share_network['id'], restart_check=True)
self.assertEqual('True', check_result['compatible']) self.assertEqual('True', check_result['compatible'])
self.assertEqual('{}', check_result['hosts_check_result']) self.assertEqual('', check_result['hosts_check_result'])

View File

@ -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.