summaryrefslogtreecommitdiffstats
path: root/auth/auth-cass/cass_init/cmd.sh
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-10-03 22:29:23 -0500
committerInstrumental <jonathan.gathman@att.com>2018-10-03 22:29:28 -0500
commitf0ddaf23df14db2e6aa637a6119198ead0222cd2 (patch)
treebb24c74b94c2ceed5986f5d4849c6f2ea99d6328 /auth/auth-cass/cass_init/cmd.sh
parent235dd9ad5309cb8c348e15c66fb3884d39dbb107 (diff)
Cass Ready Pattern->HEAT
Came up with a good Cassandra ready pattern for HELM/OOM. HEAT was having problem as well, so applied there too. Issue-ID: AAF-517 Change-Id: I2a8f2d1efd27c55e0c2c3bf60115c7abba17202b Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-cass/cass_init/cmd.sh')
-rw-r--r--auth/auth-cass/cass_init/cmd.sh28
1 files changed, 20 insertions, 8 deletions
diff --git a/auth/auth-cass/cass_init/cmd.sh b/auth/auth-cass/cass_init/cmd.sh
index b3d5292c..d1e70515 100644
--- a/auth/auth-cass/cass_init/cmd.sh
+++ b/auth/auth-cass/cass_init/cmd.sh
@@ -9,11 +9,14 @@ if [ ! -e /aaf_cmd ]; then
chmod u+x /aaf_cmd
fi
+# Always need startup status...
+if [ ! -e "$DIR" ]; then
+ mkdir -p "$DIR"
+fi
+
function status {
- if [ -d "$DIR" ]; then
echo "$@"
echo "$@" > $DIR/aaf_cass
- fi
}
function wait_start {
@@ -29,6 +32,7 @@ function wait_start {
done
}
+
function wait_cql {
status wait for keyspace to be initialized
for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
@@ -41,6 +45,19 @@ function wait_cql {
done
}
+function wait_ready {
+ status wait for cassandra to be fully ready
+ for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
+ STATUS="$(cat $DIR/aaf_cass)"
+ if [ "$STATUS" = "ready" ]; then
+ break
+ else
+ echo "Waiting for Start, $STATUS... Sleep 10"
+ sleep 10
+ fi
+ done
+}
+
function install_cql {
wait_start started
# Now, make sure data exists
@@ -126,13 +143,8 @@ case "$1" in
;;
wait)
# Wait for initialization. This can be called from Docker only as a check to make sure it is ready
- wait_start started
-
- # Make sure Keyspace is loaded
- wait_cql
+ wait_ready
- # Wait for Data load?
- status ready
;;
onap)
# start install_onap (which calls install_cql first) in background, waiting for process to start