X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fdocker%2Fagent.sh;h=820b1faa8133766a657913345b5a1d20927a22fc;hb=7a1817bf3cf3c40c6c33f673ddc46c3f115cc3bc;hp=aa3db663737505c71ed00ab462581cdece38c84d;hpb=047edb5a4312cc7dfb3172b7e11ab1a9e2315ba2;p=aaf%2Fauthz.git diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index aa3db663..820b1faa 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -1,17 +1,50 @@ #!/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==================================================== +# -CADI_VERSION=2.1.2-SNAPSHOT # Fill out "aaf.props" if not filled out already if [ ! -e aaf.props ]; then > ./aaf.props fi -for V in VERSION AAF_FQDN DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do + +. ./aaf.props + +DOCKER=${DOCKER:=docker} +CADI_VERSION=${CADI_VERSION:=2.1.7-SNAPSHOT} + +for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do if [ "$(grep $V ./aaf.props)" = "" ]; then unset DEF case $V in + DOCKER_REPOSITORY) + PROMPT="Docker Repo" + DEF="" + ;; AAF_FQDN) PROMPT="AAF's FQDN";; DEPLOY_FQI) PROMPT="Deployer's FQI";; + AAF_FQDN_IP) + # Need AAF_FQDN's IP, because not might not be available in mini-container + PROMPT="AAF FQDN IP" + DEF=$(host $AAF_FQDN | grep "has address" | tail -1 | cut -f 4 -d ' ') + ;; APP_FQI) PROMPT="App's FQI";; APP_FQDN) PROMPT="App's Root FQDN";; VOLUME) PROMPT="APP's AAF Configuration Volume";; @@ -39,26 +72,23 @@ for V in VERSION AAF_FQDN DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LON done . ./aaf.props -# Need AAF_FQDN's IP, because not might not be available in mini-container -if [ "$AAF_AAF_FQDN_IP" = "" ]; then - AAF_AAF_FQDN_IP=$(host $AAF_FQDN | grep "has address" | tail -1 | cut -f 4 -d ' ') - if [ "$AAF_AAF_FQDN_IP" = "" ]; then - read -p "IP of $AAF_FQDN: " AAF_AAF_FQDN_IP - echo "AAF_AAF_FQDN_IP=$AAF_AAF_FQDN_IP" >> ./aaf.props - fi -fi - # Make sure Container Volume exists -if [ "$(docker volume ls | grep ${VOLUME})" = "" ]; then +if [ "$($DOCKER volume ls | grep ${VOLUME})" = "" ]; then echo -n "Creating Volume: " - docker volume create -d ${DRIVER} ${VOLUME} + $DOCKER volume create -d ${DRIVER} ${VOLUME} fi -docker run \ +if [ -n "$DOCKER_REPOSITORY" ]; then + PREFIX="$DOCKER_REPOSITORY/" +else + PREFIX="" +fi + +$DOCKER run \ -it \ --rm \ - --mount 'type=volume,src='${VOLUME}',dst=/opt/app/osaaf,volume-driver='${DRIVER} \ - --add-host="$AAF_FQDN:$AAF_AAF_FQDN_IP" \ + -v "${VOLUME}:/opt/app/osaaf" \ + --add-host="$AAF_FQDN:$AAF_FQDN_IP" \ --env AAF_FQDN=${AAF_FQDN} \ --env DEPLOY_FQI=${DEPLOY_FQI} \ --env DEPLOY_PASSWORD=${DEPLOY_PASSWORD} \ @@ -67,5 +97,5 @@ docker run \ --env LATITUDE=${LATITUDE} \ --env LONGITUDE=${LONGITUDE} \ --name aaf_agent_$USER \ - onap/aaf/aaf_agent:$VERSION \ + "$PREFIX"onap/aaf/aaf_agent:$VERSION \ /bin/bash "$@"