Use status_check boolean return to control retries loop

Change-Id: Ia8042e465084c8caae8479cf96823ab06b9abda3
This commit is contained in:
Chi Lo 2020-09-30 12:17:42 -07:00
parent 09a742cadb
commit e9e6b3b1c6

View File

@ -371,19 +371,16 @@ class WorkerThread(threading.Thread):
else:
max_wait_time = CONF.resource_creation_timeout_min
start_time = time.time()
waiting_time = 0
status_check = HEATIntermediateStatusChecker(stack, operation)
status = ''
while status != HEATIntermediateStatusChecker.STATUS_COMPLETE \
and status != HEATIntermediateStatusChecker.STATUS_FAIL \
and (waiting_time <= max_wait_time):
status = True
while status and (waiting_time <= max_wait_time):
time.sleep(poll_interval)
waiting_time = time.time() - start_time
waiting_time += poll_interval
LOG.debug('Thread %s: Waiting for %s to finish;'
' time elapsed: %s', self.threadID,
stack.stack_name, int(waiting_time))
stack.stack_name, waiting_time)
stack = self._heat_client.get_stack(stack.id)
status = status_check(stack)