X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fdocker%2Fagent.sh;h=a2b1183043488be0541305dbab818ced0a67fa03;hb=628b7105ce4d9818aac69a082e515f9275fd46fd;hp=34b1dcfb51057221ed24e3e3d9254cbe1aca3006;hpb=7e5ccdd25e377cfa2dd5850ac3c2c1428c40b078;p=aaf%2Fauthz.git diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index 34b1dcfb..a2b11830 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.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==================================================== +# # Fill out "aaf.props" if not filled out already @@ -9,9 +28,9 @@ fi . ./aaf.props DOCKER=${DOCKER:=docker} -CADI_VERSION=${CADI_VERSION:=2.1.4-SNAPSHOT} +CADI_VERSION=${CADI_VERSION:=2.1.10-SNAPSHOT} -for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do +for V in VERSION DOCKER_REPOSITORY HOSTNAME 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 @@ -19,6 +38,10 @@ for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_ PROMPT="Docker Repo" DEF="" ;; + HOSTNAME) + PROMPT="HOSTNAME (blank for Default)" + DEF="" + ;; AAF_FQDN) PROMPT="AAF's FQDN";; DEPLOY_FQI) PROMPT="Deployer's FQI";; AAF_FQDN_IP) @@ -42,8 +65,10 @@ for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_ read -p "$PROMPT" VAR if [ "$VAR" = "" ]; then if [ "$DEF" = "" ]; then - echo "agent.sh needs each value queried. Please start again." - exit + if [ "$V" != "HOSTNAME" ]; then + echo "agent.sh needs each value queried. Please start again." + exit + fi else VAR=$DEF fi @@ -65,11 +90,16 @@ else PREFIX="" fi -$DOCKER run \ - -it \ - --rm \ +function run_it() { + LINKS="--link aaf-locate" + if [ -n "${DUSER}" ]; then + USER_LINE="--user ${DUSER}" + fi + $DOCKER run -it --rm \ + ${USER_LINE} \ -v "${VOLUME}:/opt/app/osaaf" \ --add-host="$AAF_FQDN:$AAF_FQDN_IP" \ + $LINKS \ --env AAF_FQDN=${AAF_FQDN} \ --env DEPLOY_FQI=${DEPLOY_FQI} \ --env DEPLOY_PASSWORD=${DEPLOY_PASSWORD} \ @@ -77,6 +107,19 @@ $DOCKER run \ --env APP_FQDN=${APP_FQDN} \ --env LATITUDE=${LATITUDE} \ --env LONGITUDE=${LONGITUDE} \ - --name aaf_agent_$USER \ + --name aaf-agent-$USER \ "$PREFIX"onap/aaf/aaf_agent:$VERSION \ - /bin/bash "$@" + bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS" +} + +PARAMS=$@ +case "$1" in + bash) + PARAMS="&& cd /opt/app/osaaf/local && exec bash" + run_it -it --rm + ;; + *) + run_it --rm + ;; +esac +