From c3a22519bcd91db227146a982bfb281092428f6c Mon Sep 17 00:00:00 2001 From: Abijitha Nadagouda Date: Thu, 6 Apr 2017 05:30:09 -0700 Subject: [PATCH] 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 --- cinderclient/tests/unit/v2/fakes.py | 6 +++--- cinderclient/v2/shell.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cinderclient/tests/unit/v2/fakes.py b/cinderclient/tests/unit/v2/fakes.py index ae21eebe0..18aa99f96 100644 --- a/cinderclient/tests/unit/v2/fakes.py +++ b/cinderclient/tests/unit/v2/fakes.py @@ -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'}, } } ) diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index dc2c14e4e..9a5d7c582 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -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',