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
This commit is contained in:
dixiaoli
2016-01-21 01:34:59 -06:00
parent 7d2359f1e3
commit 6fbcb65561
3 changed files with 8 additions and 3 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)