From d94115c342bfd01797241a385dd4c8d1ea1e0b0e Mon Sep 17 00:00:00 2001
From: Steven Dake <sdake@redhat.com>
Date: Thu, 2 Oct 2014 12:43:47 -0700
Subject: [PATCH] Restart container until mariadb is available

Fix a race condition between MariaDB service start and Keystone.

Change-Id: I31384204eca9c7201eb102ec0359b390e88b96ba
---
 docker/keystone/start.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docker/keystone/start.sh b/docker/keystone/start.sh
index b282e42e6a..aec2d72537 100755
--- a/docker/keystone/start.sh
+++ b/docker/keystone/start.sh
@@ -1,5 +1,10 @@
 #!/bin/bash
 
+# Exit the container if MariaDB is not yet up - then depend on kube to restart
+if [ -z "$MARIADBMASTER_PORT_3306_TCP_PORT" ]; then
+        exit 1
+fi
+
 : ${KEYSTONE_ADMIN_PASSWORD:=kolla}
 : ${ADMIN_TENANT_NAME:=admin}