Procházet zdrojové kódy

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/02/698902/1
Keigo Noha Emilien Macchi před 3 měsíci
rodič
revize
bcb511376a
2 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. +1
    -1
      tripleoclient/tests/test_utils.py
  2. +1
    -1
      tripleoclient/utils.py

+ 1
- 1
tripleoclient/tests/test_utils.py Zobrazit soubor

@@ -324,7 +324,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 Zobrazit soubor

@@ -374,7 +374,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,


Načítá se…
Zrušit
Uložit