X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=osdfapp.sh;h=7e3284fcf60e3eb1d69576ce5a6be423205f4f5e;hb=HEAD;hp=c54d59cb3eaee3d3934c08df38b9e0e9bec64524;hpb=c44cd62451fa956f69387115565ce28890b62160;p=optf%2Fosdf.git diff --git a/osdfapp.sh b/osdfapp.sh index c54d59c..7e3284f 100755 --- a/osdfapp.sh +++ b/osdfapp.sh @@ -18,36 +18,60 @@ # ------------------------------------------------------------------------- # -# Call osdf app after setting LD_LIBRARY_PATH for oracle client, postgres client, etc. +usage() { + echo "Usage:" + echo " $0 -h Display this help message." + echo " $0 -c configfile_path(optional) -x app.py file" + exit 0 +} cd $(dirname $0) -# Environment variables below are for ORACLE_HOME and such things, and not needed for 1707 onwards -# . ../dependencies/env.sh +# bash ../etc/make-certs.sh # create the https certificates if they are not present -bash ../etc/make-certs.sh # create the https certificates if they are not present +while getopts ":hc:x:" opt; do + case ${opt} in + h ) + usage + ;; + c ) + # process option configuration + export OSDF_CONFIG_FILE=$OPTARG + ;; + x ) + # process executable file + export EXEC_FILE=$OPTARG + ;; + ? ) + usage + ;; + : ) + echo "Invalid Option: -$OPTARG requires an argument" 1>&2 + exit 1 + ;; + esac +done +shift $(( OPTIND - 1 )) set -e -mkdir -p logs - -if [ ! -e "osdf-optim" ]; then -( - mkdir tmp - cd tmp - tar xzf ../../dependencies/SNIROOptimizationPack.tgz - mv osdf ../osdf-optim - cd ../osdf-optim/pywheels - pip install docopt* jsonschema* -) -cp etc/run-case-local.sh osdf-optim/run/ -fi +LOGS=logs +mkdir -p $LOGS -if [ $# -ge 1 ]; then - export SNIRO_MANAGER_CONFIG_FILE="$1" # this file is passed by the DCAE controller -fi +#if [ -e /opt/app/ssl_cert/aaf_root_ca.cer ]; then +# #assuming that this would be an ubuntu vm. +# cp /opt/app/ssl_cert/aaf_root_ca.cer /usr/local/share/ca-certificates/aafcacert.crt +# chmod 444 /usr/local/share/ca-certificates/aafcacert.crt +# update-ca-certificates +#fi -# export FLASK_APP=osdfapp.py +export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt -# flask run -python osdfapp.py # running the app +if [ ! -z "$EXEC_FILE" ] +then + # flask run + echo "Running $EXEC_FILE" + python $EXEC_FILE # running the app +else + usage +fi