From 724901e3740fd6429a851f4dbceecbc117750c44 Mon Sep 17 00:00:00 2001 From: Huanxuan Ao Date: Mon, 6 Jun 2016 14:15:38 +0800 Subject: [PATCH] Fix output error for type-show command Before this patch, the output of "extra_specs" in type-show command is this: | extra_specs | {u'Alpha': u'a'} | Becuase the type of "extra_specs" is not a string and need to use unicode_key_value_to_string() method to change it to string. This patch add formatters and call unicode_key_value_to_string() mothod for "extra_specs" and change the output to this: | extra_specs | {'Alpha': 'a'} | Change-Id: Ia2e2633068ce5b5e6622474b145a1d4f074fd551 Closes-Bug: #1589461 --- cinderclient/tests/unit/v2/fakes.py | 2 +- cinderclient/v3/shell.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cinderclient/tests/unit/v2/fakes.py b/cinderclient/tests/unit/v2/fakes.py index 199482653..9ce217af6 100644 --- a/cinderclient/tests/unit/v2/fakes.py +++ b/cinderclient/tests/unit/v2/fakes.py @@ -645,7 +645,7 @@ class FakeHTTPClient(base_client.HTTPClient): return (200, {}, {'volume_type': {'id': 1, 'name': 'test-type-1', 'description': 'test_type-1-desc', - 'extra_specs': {}}}) + 'extra_specs': {u'key': u'value'}}}) def get_types_2(self, **kw): return (200, {}, {'volume_type': {'id': 2, diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index 235f9ddbd..99290e968 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -898,7 +898,7 @@ def do_type_show(cs, args): info.update(vtype._info) info.pop('links', None) - utils.print_dict(info) + utils.print_dict(info, formatters=['extra_specs']) @utils.arg('id',