From 741f5fe770d765e492102f1650f44ea85162e925 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Wed, 22 Jan 2020 11:52:48 -0500 Subject: [PATCH] ara_api role: allow retries when attempting to run sql migrations We've seen sql migrations unexplicably fail in integration tests against mysql and postgresql only to succeed if ran manually later. It doesn't hurt to re-try migrations if the command hasn't succeeded the first time around so implement a retry to see if this improves the success rate. Change-Id: Id10bfb9a643bbb3ec1907580826104ded30db2a6 --- .../tasks/database_engine/django.db.backends.mysql.yaml | 4 ++++ .../tasks/database_engine/django.db.backends.postgresql.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/roles/ara_api/tasks/database_engine/django.db.backends.mysql.yaml b/roles/ara_api/tasks/database_engine/django.db.backends.mysql.yaml index 983ca565..6634eaac 100644 --- a/roles/ara_api/tasks/database_engine/django.db.backends.mysql.yaml +++ b/roles/ara_api/tasks/database_engine/django.db.backends.mysql.yaml @@ -48,3 +48,7 @@ PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}" command: ara-manage migrate run_once: true + register: _ara_sql_migrations + retries: 3 + delay: 5 + until: _ara_sql_migrations is succeeded diff --git a/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml b/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml index ad144459..0a5e02ac 100644 --- a/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml +++ b/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml @@ -48,3 +48,7 @@ PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}" command: ara-manage migrate run_once: true + register: _ara_sql_migrations + retries: 3 + delay: 5 + until: _ara_sql_migrations is succeeded