Bläddra i källkod

Retry the connection to heat-api when 500 code

In a rare case like httpd reload by logrotate, heat-api returns
500 code. If this happens, trpleoclient can't get the status of
the stack even though the process is still on-going.

To handle this situation, tipleoclient should retry when it can't
get the stack information by 500 code.

Change-Id: I97a6825f4ff9f125eb597e5b7bd0c553c37e49e7
Closes-Bug: #1855633
(cherry picked from commit 932fc6755a)
changes/03/698903/1
Keigo Noha Emilien Macchi 5 månader sedan
förälder
incheckning
70b28932fd
2 ändrade filer med 2 tillägg och 2 borttagningar
  1. +1
    -1
      tripleoclient/tests/test_utils.py
  2. +1
    -1
      tripleoclient/utils.py

+ 1
- 1
tripleoclient/tests/test_utils.py Visa fil

@@ -412,7 +412,7 @@ class TestWaitForStackUtil(TestCase):
mock_get_stack.return_value = stack
mock_poll.side_effect = hc_exc.HTTPException(code=500)

self.assertRaises(hc_exc.HTTPException,
self.assertRaises(RuntimeError,
utils.wait_for_stack_ready,
self.mock_orchestration, 'stack')



+ 1
- 1
tripleoclient/utils.py Visa fil

@@ -365,7 +365,7 @@ def wait_for_stack_ready(orchestration_client, stack_name, marker=None,
print(msg)
return stack_status == '%s_COMPLETE' % action
except hc_exc.HTTPException as e:
if e.code in [503, 504]:
if e.code in [500, 503, 504]:
retries += 1
log.warning("Server issue while waiting for stack to be ready."
" Attempting retry {} of {}".format(retries,


Laddar…
Avbryt
Spara