From d83cb3c47317766e2cdc05942e2b1c8c288c53a1 Mon Sep 17 00:00:00 2001
From: SamYaple <sam@yaple.net>
Date: Fri, 4 Mar 2016 16:01:07 +0000
Subject: [PATCH] Retry token retrival in keystone bootstrap script

TrivialFix

Change-Id: I83da0298067d5f37603c52fb312828ea1fbbb00c
---
 docker/keystone/keystone_bootstrap.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/docker/keystone/keystone_bootstrap.sh b/docker/keystone/keystone_bootstrap.sh
index 15c1838db..0c0aa498d 100644
--- a/docker/keystone/keystone_bootstrap.sh
+++ b/docker/keystone/keystone_bootstrap.sh
@@ -73,10 +73,16 @@ if [[ ! $(openstack --os-identity-api-version 3 --os-token "${OS_TOKEN}" --os-ur
     )
 fi
 
-get_token
+count=0
+while [[ ! "${OS_TOKEN}" && "${count}" -lt 5 ]]; do
+    get_token
+    ((count++))
+    sleep 1
+done
 if [[ ! "${OS_TOKEN}" ]]; then
-    fail_json "Unable to issue token"
+    fail_json "Unable to retrieve token after 5 attempts"
 fi
+
 create_service
 create_endpoints
 exit_json
-- 
GitLab