Fix error when listing stacks

Previously the stack list command would error out if any stacks were
present. This was due to the action code attempting to index on a
stack object, rather than grabbing its attributes. This change switches
the action code to use the proper utility for a resource instead of
a dict.

Change-Id: Ia6b73d5c1ba7f7e3d7bc5493167da81062102b42
Blueprint: heat-support-python-openstackclient
This commit is contained in:
Bryan Jones
2015-11-18 21:30:51 +00:00
parent 681e5e12bd
commit cdcd716553
2 changed files with 3 additions and 2 deletions

View File

@@ -226,5 +226,5 @@ def _list(client, args=None):
return (
columns,
(utils.get_dict_properties(s, columns) for s in data)
(utils.get_item_properties(s, columns) for s in data)
)

View File

@@ -116,7 +116,8 @@ class TestStackList(TestStack):
def setUp(self):
super(TestStackList, self).setUp()
self.cmd = stack.ListStack(self.app, None)
self.stack_client.list = mock.MagicMock(return_value=[self.data])
self.stack_client.list = mock.MagicMock(
return_value=[stacks.Stack(None, self.data)])
utils.get_dict_properties = mock.MagicMock(return_value='')
def test_stack_list_defaults(self):