summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-10-03 19:40:44 -0500
committerInstrumental <jonathan.gathman@att.com>2018-10-03 19:41:20 -0500
commit1e3be601c78fa851333e51c6498713d1c412bd62 (patch)
tree20d56a99089f6f6d3acd055e2522675c85457ebb
parent7e97d0c2c5a10e92d1233117bb60bfd9e42d35a0 (diff)
Change FQDN Register
Issue-ID: AAF-517 Change-Id: I816e7a18f94e7f7fcfc269b29328d7009fc8f858 Signed-off-by: Instrumental <jonathan.gathman@att.com>
-rw-r--r--auth/auth-cass/cass_init/cmd.sh44
-rw-r--r--auth/auth-cass/docker/dinstall.sh18
-rw-r--r--auth/docker/drun.sh20
-rw-r--r--conf/CA/bootstrap.sh13
-rw-r--r--conf/CA/san_root.aaf1
5 files changed, 80 insertions, 16 deletions
diff --git a/auth/auth-cass/cass_init/cmd.sh b/auth/auth-cass/cass_init/cmd.sh
index 09379730..afb66774 100644
--- a/auth/auth-cass/cass_init/cmd.sh
+++ b/auth/auth-cass/cass_init/cmd.sh
@@ -16,20 +16,36 @@ function status {
fi
}
-function install_cql {
- status install
+function wait_start {
sleep 10
status wait for cassandra to start
+ for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
+ if [ -z "$(grep 'listening for CQL clients' /var/log/cassandra/system.log)" ]; then
+ echo "Waiting for Cassandra to start... Sleep 10"
+ sleep 10
+ else
+ break
+ fi
+ 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
+ if [ "`/usr/bin/cqlsh -e 'describe keyspaces' | grep authz`" == "" ]; then
+ break
+ else
+ echo "Waiting for Keyspaces to be loaded... Sleep 10"
+ sleep 10
+ fi
+ done
+}
+
+function install_cql {
+ wait_start started
# Now, make sure data exists
if [ "$(/usr/bin/cqlsh -e 'describe keyspaces' | grep authz)" = "" ]; then
- for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
- if [ -z "$(grep 'listening for CQL clients' /var/log/cassandra/system.log)" ]; then
- echo "Waiting for Cassandra to start... Sleep 10"
- sleep 10
- else
- break
- fi
- done
+ status install
echo "Initializing Cassandra DB"
if [ "`/usr/bin/cqlsh -e 'describe keyspaces' | grep authz`" == "" ]; then
echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
@@ -108,6 +124,14 @@ case "$1" in
echo "Cassandra Startup"
/usr/local/bin/docker-entrypoint.sh
;;
+ 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
+ status ready
+ ;;
onap)
# start install_onap (which calls install_cql first) in background, waiting for process to start
install_onap &
diff --git a/auth/auth-cass/docker/dinstall.sh b/auth/auth-cass/docker/dinstall.sh
index c21b7fcc..ec82d8af 100644
--- a/auth/auth-cass/docker/dinstall.sh
+++ b/auth/auth-cass/docker/dinstall.sh
@@ -1,7 +1,19 @@
#!/bin/bash
-
+#
+# This is only called from HEAT, as it needs a single check and wait for Cassandra to be ready
+#
. drun.sh
-# echo $DOCKER
-# docker exec -it aaf_cass bash aaf_cmd onap
+echo "Waiting for Cass to be initialized"
+for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
+ docker exec -it aaf_cass bash aaf_cmd wait 2> /dev/null
+ if [ "$?" -ne "0" ]; then
+ echo "Container not ready... Sleep 10"
+ sleep 10
+ else
+ echo "aaf_cass is ready"
+ break
+ fi
+done
+
diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh
index 350ce3db..a8f03936 100644
--- a/auth/docker/drun.sh
+++ b/auth/docker/drun.sh
@@ -59,13 +59,29 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do
echo Starting aaf_$AAF_COMPONENT...
+ if [ -n "$AAF_REGISTER_AS" ] && [ "$HOSTNAME" != "$AAF_REGISTER_AS" ]; then
+ AH_ROOT="$HOSTNAME $AAF_REGISTER_AS"
+ else
+ AH_ROOT="$HOSTNAME"
+ fi
+
+ for A in aaf.osaaf.org $AH_ROOT; do
+ ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
+ for SA in service locate oauth gui fs cm hello; do
+ ADD_HOST="$ADD_HOST --add-host=$SA.$A:$HOST_IP"
+ done
+ done
+
docker run \
-d \
--name aaf_$AAF_COMPONENT \
--hostname="${AAF_COMPONENT}.aaf.osaaf.org" \
- --add-host="$HOSTNAME:$HOST_IP" \
- --add-host="aaf.osaaf.org:$HOST_IP" \
+ $ADD_HOST \
${LINKS} \
+ --env AAF_ENV=${AAF_ENV} \
+ --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
+ --env LATITUDE=${LATITUDE} \
+ --env LONGITUDE=${LONGITUDE} \
--publish $PORTMAP \
--mount 'type=volume,src=aaf_config,dst='$CONF_ROOT_DIR',volume-driver=local' \
${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
diff --git a/conf/CA/bootstrap.sh b/conf/CA/bootstrap.sh
index 6d4e1aa5..056fb3a4 100644
--- a/conf/CA/bootstrap.sh
+++ b/conf/CA/bootstrap.sh
@@ -64,8 +64,19 @@ fi
# SANS
cp san.conf $BOOTSTRAP_SAN
+SANS=$FQDN
+if [ "$FQDN" -ne "$HOSTNAME" ]; then
+ SANS="$SANS $HOSTNAME"
+fi
+
+for ROOT in $(cat san_root.aaf); do
+ SANS="$SANS $ROOT"
+ for C in service locate oauth gui cm hello; do
+ SANS="$SANS $C.$ROOT"
+ done
+done
NUM=1
-for D in $FQDN aaf.osaaf.org service.aaf.osaaf.org locate.aaf.osaaf.org oauth.aaf.osaaf.org gui.aaf.osaaf.org cm.aaf.osaaf.org hello.aaf.osaaf.org; do
+for D in $SANS; do
echo "DNS.$NUM = $D" >> $BOOTSTRAP_SAN
NUM=$((NUM+1))
done
diff --git a/conf/CA/san_root.aaf b/conf/CA/san_root.aaf
new file mode 100644
index 00000000..ec275a35
--- /dev/null
+++ b/conf/CA/san_root.aaf
@@ -0,0 +1 @@
+aaf.osaaf.org aaf.api.simpledemo.onap.org