Custom Stack get method to avoid lookup redirects
Change-Id: I15dd4e9168cba6fd05371fed097d52cbf33cb15d
This commit is contained in:
parent
6f7239f67b
commit
ea0e957978
@ -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')
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user