X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fsample%2Fbin%2Fservice.sh;h=2b964b1c26df0978ab6bef406cd8e110a5d5dd68;hb=27afb0201ce717c25d8ffcc50f8b4972fc98f5c5;hp=7e443b533ab71a042d14ac2e1ba4df8f3d780029;hpb=284ad0ad02fc18f8603f777b8cc38ba1d73e4b83;p=aaf%2Fauthz.git diff --git a/auth/sample/bin/service.sh b/auth/sample/bin/service.sh index 7e443b53..2b964b1c 100644 --- a/auth/sample/bin/service.sh +++ b/auth/sample/bin/service.sh @@ -1,4 +1,23 @@ #!/bin/bash +######### +# ============LICENSE_START==================================================== +# org.onap.aaf +# =========================================================================== +# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# =========================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END==================================================== +# # 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) # @@ -13,20 +32,25 @@ CONFIG=/opt/app/aaf_config JAVA_CADI="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar org.onap.aaf.cadi.CmdLine" JAVA_AGENT="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.props org.onap.aaf.cadi.configure.Agent" JAVA_AAFCLI="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.props org.onap.aaf.auth.cmd.AAFcli" +JAVA_AAFBATCH="$JAVA -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.batch.props -jar $CONFIG/bin/aaf-auth-batch-*-full.jar" # If doesn't exist... still create -mkdir -p /opt/app/osaaf +mkdir -p $OSAAF + +# If not created by separate PV, create +mkdir -p /opt/app/aaf/status # Temp use for clarity of code FILE= # Setup Bash, first time only -if [ ! -e "$HOME/.bash_aliases" ] || [ -z "$(grep cadi $HOME/.bash_aliases)" ]; then - echo "alias cadi='$JAVA_CADI \$*'" >>$HOME/.bash_aliases - echo "alias agent='$CONFIG/bin/agent.sh EMPTY \$*'" >>$HOME/.bash_aliases - echo "alias aafcli='$JAVA_AAFCLI \$*'" >>$HOME/.bash_aliases +if [ ! -e "$HOME/.bashrc" ] || [ -z "$(grep cadi $HOME/.bashrc)" ]; then + echo "alias cadi='$JAVA_CADI \$*'" >>$HOME/.bashrc + echo "alias agent='$CONFIG/bin/agent.sh \$*'" >>$HOME/.bashrc + echo "alias aafcli='$JAVA_AAFCLI \$*'" >>$HOME/.bashrc + echo "alias batch='$JAVA_AAFBATCH \$*'" >>$HOME/.bashrc chmod a+x $CONFIG/bin/agent.sh - . $HOME/.bash_aliases + . $HOME/.bashrc fi # Only load Identities once @@ -95,9 +119,10 @@ fi # Only initialize once, automatically... if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then - rsync -avzh --exclude=.gitignore $CONFIG/local/org.osaaf.aaf* $LOCAL + cp $CONFIG/local/org.osaaf.aaf* $LOCAL for D in public etc logs; do - rsync -avzh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D + mkdir -p $OSAAF/$D + cp $CONFIG/$D/* $OSAAF/$D done TMP=$(mktemp) @@ -106,9 +131,13 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then echo cadi_latitude=${LATITUDE} >> ${TMP} echo cadi_longitude=${LONGITUDE} >> ${TMP} echo cadi_x509_issuers=${CADI_X509_ISSUERS} >> ${TMP} - echo aaf_register_as=${AAF_REGISTER_AS} >> ${TMP} - AAF_LOCATOR_AS=${AAF_LOCATOR_AS:=$AAF_REGISTER_AS} - echo aaf_locate_url=https://${AAF_LOCATOR_AS}:8095 >> ${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 + echo "$P" >> ${TMP} + fi + done cat $TMP @@ -120,7 +149,7 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then # Cassandra Config stuff # Default is expect a Cassandra on same Node - CASS_HOST=${CASS_HOST:="aaf_cass"} + 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}/" \ @@ -146,7 +175,7 @@ fi # Now run a command -CMD=$2 +CMD=$1 if [ -z "$CMD" ]; then if [ -n "$INITIALIZED" ]; then echo "Initialization Complete" @@ -154,12 +183,11 @@ if [ -z "$CMD" ]; then echo "No Additional Initialization required" fi else - shift shift case "$CMD" in ls) echo ls requested - find /opt/app/osaaf -depth + find $OSAAF -depth ;; cat) if [ "$1" = "" ]; then @@ -176,12 +204,6 @@ else fi fi ;; - update) - rsync -uh --exclude=.gitignore $CONFIG/local/org.osaaf.aaf* $LOCAL - for D in public data etc logs; do - rsync -uh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D - done - ;; validate) echo "## validate requested" $JAVA_AAFCLI perm list user aaf@aaf.osaaf.org @@ -192,7 +214,7 @@ else bash) shift cd $LOCAL || exit - /bin/bash "$@" + exec /bin/bash -c "$@" ;; setProp) cd $LOCAL || exit @@ -207,11 +229,11 @@ else fi for F in $FILES; do if [ "$ADD" = "Y" ]; then - echo "Changing $1 to $F" + echo "Changing $1 for $F" echo "$1=$2" >> $F else echo "Changing $1 in $F" - sed -i.backup -e "s/\\(${1}.*=\\).*/\\1${2}/" $F + sed -i.backup -e "s/\\(${1}=\\).*/\\1${2}/" $F fi cat $F done @@ -246,8 +268,11 @@ else done ;; taillog) - sh /opt/app/osaaf/logs/taillog + sh $OSAAF/logs/taillog ;; + wait) + bash $CONFIG/bin/pod_wait.sh wait $1 + ;; --help | -?) case "$1" in "")