summaryrefslogtreecommitdiffstats
path: root/auth/sample
diff options
context:
space:
mode:
authorSai Gandham <sai.gandham@att.com>2019-04-17 19:42:30 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-17 19:42:30 +0000
commit5c01796be69ed71c360dade8a080a4fd22c06447 (patch)
treedd4ca9d606f2cb8d6c16440b984f4b01585c2ffc /auth/sample
parent22d821ef35b5ddaf76937ab6a4fe82b088a50a26 (diff)
parentfea400a6e11a41e39911927edf37938b5d13f181 (diff)
Merge "Make OOM workable with Dublin"2.1.11
Diffstat (limited to 'auth/sample')
-rwxr-xr-xauth/sample/bin/client.sh4
-rw-r--r--auth/sample/bin/pod_wait.sh90
-rw-r--r--auth/sample/bin/service.sh29
3 files changed, 84 insertions, 39 deletions
diff --git a/auth/sample/bin/client.sh b/auth/sample/bin/client.sh
index 0dff8037..dbf08622 100755
--- a/auth/sample/bin/client.sh
+++ b/auth/sample/bin/client.sh
@@ -174,7 +174,7 @@ if [ -z "$CMD" ]; then
if [ -n "$INITIALIZED" ]; then
echo "Initialization complete"
else
- $JAVA_AGENT
+ $JAVA_AGENT_SELF validate $FQI $FQDN
fi
else
shift
@@ -209,7 +209,7 @@ else
;;
validate)
echo "## validate requested"
- $JAVA_AGENT_SELF validate
+ $JAVA_AGENT_SELF validate $FQI $FQDN
;;
renew)
echo "## Renew Certificate"
diff --git a/auth/sample/bin/pod_wait.sh b/auth/sample/bin/pod_wait.sh
index 3d6a1b9e..5a10476a 100644
--- a/auth/sample/bin/pod_wait.sh
+++ b/auth/sample/bin/pod_wait.sh
@@ -24,8 +24,6 @@
DIR="/opt/app/aaf/status"
APP=$1
shift
-OTHER=$1
-shift
function status {
if [ -d "$DIR" ]; then
@@ -62,6 +60,25 @@ function wait {
done
}
+function wait_nc {
+ n=0
+ while [ $n -lt 40 ]; do
+ echo "Waiting for Network Access to $@"
+ status "Waiting for Network Access to $1 $2"
+ rv="$(nc -zvw 5 $1 $2 2>&1 | grep -e "[open|succeed]")"
+ echo $rv
+
+ if [[ "$rv" == *open* ]] || [[ "$rv" == *succeeded* ]]; then
+ status "Network Connectable to $1 $2"
+ n=10000
+ else
+ (( ++n ))
+ echo "Sleep 10 (iteration $n)"
+ sleep 10
+ fi
+ done
+}
+
function start {
n=0
while [ $n -lt 40 ]; do
@@ -80,30 +97,47 @@ function start {
done
}
-case "$OTHER" in
- sleep)
- echo "Sleeping $1"
- status "Sleeping $1"
- sleep $1
- shift
- status "ready"
- echo "Done"
+while [ ! -z "$1" ]; do
+ OTHER=$1
+ shift
+ case "$OTHER" in
+ nc)
+ H=$1
+ shift
+ P=$1
+ shift
+ wait_nc "$H" "$P"
+ if [ -z "$@" ]; then
+ echo "ready"
+ status "ready"
+ fi
+ ;;
+ sleep)
+ echo "Sleeping $1"
+ status "Sleeping $1"
+ sleep $1
+ shift
+ if [ -z "$@" ]; then
+ echo "ready"
+ status "ready"
+ fi
+ echo "Done"
+ ;;
+ remove)
+ echo "Removing $DIR/$APP-$HOSTNAME"
+ rm -f $DIR/$APP-$HOSTNAME
+ ;;
+ wait)
+ OTHER="$1"
+ shift
+ wait
+ ;;
+ *)
+ echo "App $APP is waiting to start until $OTHER is ready"
+ status "waiting for $OTHER"
+
+ start
+ break
;;
- stop)
- echo "Removing $DIR/$APP-$HOSTNAME"
- rm $DIR/$APP-$HOSTNAME
- ;;
- wait)
- OTHER="$1"
- shift
- wait
- ;;
- *)
- echo "App $APP is waiting to start until $OTHER is ready"
- status "waiting for $OTHER"
-
- start
- ;;
-esac
-
-eval "$@"
+ esac
+done
diff --git a/auth/sample/bin/service.sh b/auth/sample/bin/service.sh
index 54a1cc58..1a289d35 100644
--- a/auth/sample/bin/service.sh
+++ b/auth/sample/bin/service.sh
@@ -21,6 +21,24 @@
# This script is run when starting aaf_config Container.
# It needs to cover the cases where the initial data doesn't exist, and when it has already been configured (don't overwrite)
#
+
+echo "# Properties passed in"
+ for P in `env`; do
+ if [[ "$P" == cadi* ]] || [[ "$P" == aaf* ]] || [[ "$P" == HOSTNAME* ]]; then
+ S="${P/_helm/.helm}"
+ S="${S/_oom/.oom}"
+ echo "$S"
+ fi
+ done
+
+# Set from CAP Based PROPS, if necessary
+aaf_env=${aaf_env:-"${AAF_ENV}"}
+aaf_release=${aaf_release:-"${VERSION}"}
+cadi_latitude=${cadi_latitude:-"${LATITUDE}"}
+cadi_longitude=${cadi_longitude:-"${LONGITUDE}"}
+cadi_x509_issuers=${cadi_x509_issuers:-"${CADI_X509_ISSUERS}"}
+aaf_locate_url=${aaf_locate_url:-"https://${HOSTNAME}:8095"}
+
JAVA=/usr/bin/java
OSAAF=/opt/app/osaaf
@@ -126,15 +144,8 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then
done
TMP=$(mktemp)
- echo aaf_env=${AAF_ENV} >> ${TMP}
- echo aaf_release=${VERSION} >> ${TMP}
- echo cadi_latitude=${LATITUDE} >> ${TMP}
- echo cadi_longitude=${LONGITUDE} >> ${TMP}
- echo cadi_x509_issuers=${CADI_X509_ISSUERS} >> ${TMP}
- AAF_LOCATE_URL=${aaf_locate_url:="https://${HOSTNAME}:8095"}
- echo aaf_locate_url=${AAF_LOCATE_URL} >> ${TMP}
for P in `env`; do
- if [[ "$P" == aaf_locator* ]]; then
+ if [[ "$P" == aaf_* ]] || [[ "$P" == cadi_* ]]; then
S="${P/_helm/.helm}"
S="${S/_oom/.oom}"
echo "$S" >> ${TMP}
@@ -154,7 +165,7 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then
CASS_HOST=${CASS_HOST:="aaf-cass"}
CASS_PASS=$($JAVA_CADI digest "${CASSANDRA_PASSWORD:-cassandra}" $LOCAL/org.osaaf.aaf.keyfile)
CASS_NAME=${CASS_HOST/:*/}
- sed -i.backup -e "s/\\(cassandra.clusters=\\).*/\\1${CASSANDRA_CLUSTERS:=$CASS_HOST}/" \
+ sed -i.backup -e "s/\\(cassandra.clusters=\\).*/\\1${CASSANDRA_CLUSTER:=$CASS_HOST}/" \
-e "s/\\(cassandra.clusters.user=\\).*/\\1${CASSANDRA_USER:=cassandra}/" \
-e "s/\\(cassandra.clusters.password=enc:\\).*/\\1$CASS_PASS/" \
-e "s/\\(cassandra.clusters.port=\\).*/\\1${CASSANDRA_PORT:=9042}/" \