From 6fbcb655619f5b985cb73f1710c3399c98975976 Mon Sep 17 00:00:00 2001 From: dixiaoli Date: Thu, 21 Jan 2016 01:34:59 -0600 Subject: [PATCH] Add formatters for 'tags' in method _do_stack_show This change added json_formatter for 'tags' in method _do_stack_show. Change-Id: Icdd3c90d237804926657103dcc846f48f4355fde Closes-Bug: #1536492 --- heatclient/osc/v1/stack.py | 1 + heatclient/tests/unit/test_shell.py | 7 +++++-- heatclient/v1/shell.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py index 75978e6f..5cc5deab 100644 --- a/heatclient/osc/v1/stack.py +++ b/heatclient/osc/v1/stack.py @@ -419,6 +419,7 @@ def _show_stack(heat_client, stack_id, format='', short=False): formatters['parameters'] = complex_formatter formatters['outputs'] = complex_formatter formatters['links'] = complex_formatter + formatters['tags'] = complex_formatter return columns, utils.get_item_properties(data, columns, formatters=formatters) diff --git a/heatclient/tests/unit/test_shell.py b/heatclient/tests/unit/test_shell.py index 735b0879..356aebf5 100644 --- a/heatclient/tests/unit/test_shell.py +++ b/heatclient/tests/unit/test_shell.py @@ -754,7 +754,8 @@ class ShellTestUserPass(ShellBase): "id": "1", "stack_name": "teststack", "stack_status": 'CREATE_COMPLETE', - "creation_time": "2012-10-25T01:58:47Z" + "creation_time": "2012-10-25T01:58:47Z", + "tags": [u'tag1', u'tag2'] }} resp = fakes.FakeHTTPResponse( 200, @@ -777,9 +778,11 @@ class ShellTestUserPass(ShellBase): 'stack_name', 'stack_status', 'creation_time', + 'tags', 'teststack', 'CREATE_COMPLETE', - '2012-10-25T01:58:47Z' + '2012-10-25T01:58:47Z', + "['tag1', 'tag2']", ] for r in required: self.assertRegexpMatches(list_text, r) diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 1fc6b4e1..b8c6e1e4 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -1575,7 +1575,8 @@ def _do_stack_show(hc, fields): 'stack_status_reason': utils.text_wrap_formatter, 'parameters': utils.json_formatter, 'outputs': utils.json_formatter, - 'links': utils.link_formatter + 'links': utils.link_formatter, + 'tags': utils.json_formatter } utils.print_dict(stack.to_dict(), formatters=formatters)