Merge "Do not confuse terminal stack statuses"

This commit is contained in:
Jenkins 2015-08-11 18:26:14 +00:00 committed by Gerrit Code Review
commit a03201da7d

View File

@ -44,6 +44,7 @@ class HeatStack(murano_object.MuranoObject):
self._applied = True self._applied = True
self._description = description self._description = description
self._clients = helpers.get_environment(_context).clients self._clients = helpers.get_environment(_context).clients
self._last_stack_timestamps = (None, None)
def current(self, _context): def current(self, _context):
client = self._clients.get_heat_client(_context) client = self._clients.get_heat_client(_context)
@ -115,7 +116,7 @@ class HeatStack(murano_object.MuranoObject):
self._wait_state(context, status_func) self._wait_state(context, status_func)
return status[0] return status[0]
def _wait_state(self, context, status_func): def _wait_state(self, context, status_func, wait_progress=False):
tries = 4 tries = 4
delay = 1 delay = 1
while tries > 0: while tries > 0:
@ -138,9 +139,16 @@ class HeatStack(murano_object.MuranoObject):
eventlet.sleep(delay) eventlet.sleep(delay)
break break
if 'IN_PROGRESS' in status or status == '_': last_stack_timestamps = self._last_stack_timestamps
self._last_stack_timestamps = (None, None) if not stack_info \
else(stack_info.creation_time, stack_info.updated_time)
if 'IN_PROGRESS' in status or status == '_' or (
wait_progress and last_stack_timestamps ==
self._last_stack_timestamps):
eventlet.sleep(2) eventlet.sleep(2)
continue continue
if not status_func(status): if not status_func(status):
reason = ': {0}'.format( reason = ': {0}'.format(
stack_info.stack_status_reason) if stack_info else '' stack_info.stack_status_reason) if stack_info else ''
@ -197,7 +205,7 @@ class HeatStack(murano_object.MuranoObject):
disable_rollback=True) disable_rollback=True)
self._wait_state( self._wait_state(
_context, _context,
lambda status: status == 'UPDATE_COMPLETE') lambda status: status == 'UPDATE_COMPLETE', True)
else: else:
self.delete(_context) self.delete(_context)