From 4f3dade26639b5296e6483086b509e4193e9cf89 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 27 Feb 2017 21:58:15 -0800 Subject: [PATCH] Add retries for ansible-test docker run. --- test/runner/lib/delegation.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/runner/lib/delegation.py b/test/runner/lib/delegation.py index 726397b670..d2fb861ff8 100644 --- a/test/runner/lib/delegation.py +++ b/test/runner/lib/delegation.py @@ -246,7 +246,15 @@ def docker_run(args, image, options): if not options: options = [] - return docker_command(args, ['run'] + options + [image], capture=True) + for _ in range(1, 3): + try: + return docker_command(args, ['run'] + options + [image], capture=True) + except SubprocessError as ex: + display.error(ex) + display.warning('Failed to run docker image "%s". Waiting a few seconds before trying again.' % image) + time.sleep(3) + + raise ApplicationError('Failed to run docker image "%s".' % image) def docker_rm(args, container_id):