Removes unicode 'u' response for "cinder get-capabilities"

The output of "cinder get-capabilities" command returns
unicoded response. But it would appear from the utils
class that setting formatters will go through the
capabilities dict and make sure all values are properly
string formatted. Therefore added formatters to return
string formatted response.

Added formatters=sorted(prop.keys()) line instead of
static values as suggested by the reviewer, to avoid
tying server knowledge to the client and also any
update on the server side would easily reflect here.

Closes-bug: #1680444
Change-Id: Ie38236db364d59ddab42cb925d0435777b0ffe86
This commit is contained in:
Abijitha Nadagouda 2017-04-06 05:30:09 -07:00
parent 0a323eaf94
commit c3a22519bc
2 changed files with 5 additions and 4 deletions

View File

@ -1278,9 +1278,9 @@ class FakeHTTPClient(base_client.HTTPClient):
'storage_protocol': 'iSCSI',
'properties': {
'compression': {
'title': 'Compression',
'description': 'Enables compression.',
'type': 'boolean'},
u'title': u'Compression',
u'description': u'Enables compression.',
u'type': u'boolean'},
}
}
)

View File

@ -2375,7 +2375,8 @@ def do_get_capabilities(cs, args):
prop = infos.pop('properties', None)
utils.print_dict(infos, "Volume stats")
utils.print_dict(prop, "Backend properties")
utils.print_dict(prop, "Backend properties",
formatters=sorted(prop.keys()))
@utils.arg('volume',