[OSC] Fix output format for osc share subnet create
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. With this change, we are enhancing the consistency of the client and the readability of the output. Closes-bug: #1989818 Change-Id: I05413e9e8b846d725d8fe021daf5d320857aac2f
This commit is contained in:
parent
7a6f7097f7
commit
799278e644
@ -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,
|
||||
|
@ -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'])
|
||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user