diff --git a/heatclient/tests/test_stacks.py b/heatclient/tests/test_stacks.py index 722a9eb8..f2a4b961 100644 --- a/heatclient/tests/test_stacks.py +++ b/heatclient/tests/test_stacks.py @@ -53,3 +53,9 @@ class StackOperationsTest(testtools.TestCase): stack = Stack(manager, {'id': 'abcd1234'}) stack.delete() manager.delete.assert_called_once_with('abcd1234') + + def test_get_stack(self): + manager = MagicMock() + stack = Stack(manager, {'id': 'abcd1234', 'stack_name': 'the_stack'}) + stack.get() + manager.get.assert_called_once_with('the_stack/abcd1234') diff --git a/heatclient/v1/stacks.py b/heatclient/v1/stacks.py index dabe8dd2..b9e76fc4 100644 --- a/heatclient/v1/stacks.py +++ b/heatclient/v1/stacks.py @@ -33,6 +33,16 @@ class Stack(base.Resource): def data(self, **kwargs): return self.manager.data(self, **kwargs) + def get(self): + # set_loaded() first ... so if we have to bail, we know we tried. + self.set_loaded(True) + if not hasattr(self.manager, 'get'): + return + + new = self.manager.get('%s/%s' % (self.stack_name, self.id)) + if new: + self._add_details(new._info) + @property def action(self): s = self.stack_status