diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-04-17 14:30:28 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-04-17 14:30:34 -0500 |
commit | fea400a6e11a41e39911927edf37938b5d13f181 (patch) | |
tree | 7119747597fc2c527235876baac29ea12f89d81e /auth/sample/bin | |
parent | 66424b306877435b7e71e119a8d1498b4b263719 (diff) |
Make OOM workable with Dublin
Issue-ID: AAF-809
Change-Id: I7c2c221e69a87f3bdf6dbf37fc93c1a14a055686
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/sample/bin')
-rwxr-xr-x | auth/sample/bin/client.sh | 4 | ||||
-rw-r--r-- | auth/sample/bin/pod_wait.sh | 90 | ||||
-rw-r--r-- | auth/sample/bin/service.sh | 29 |
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}/" \ |