From cdcd7165531a672dd0fdc1c9efd9f714bb0ec9dc Mon Sep 17 00:00:00 2001 From: Bryan Jones Date: Wed, 18 Nov 2015 21:30:51 +0000 Subject: [PATCH] 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 --- heatclient/osc/v1/stack.py | 2 +- heatclient/tests/unit/osc/v1/test_stack.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py index d9381b69..6e471f08 100644 --- a/heatclient/osc/v1/stack.py +++ b/heatclient/osc/v1/stack.py @@ -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) ) diff --git a/heatclient/tests/unit/osc/v1/test_stack.py b/heatclient/tests/unit/osc/v1/test_stack.py index 95514d5c..2f33ed1a 100644 --- a/heatclient/tests/unit/osc/v1/test_stack.py +++ b/heatclient/tests/unit/osc/v1/test_stack.py @@ -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):