From 62bb1f83ba6658184d23bbaa465eb80011de3b2b Mon Sep 17 00:00:00 2001 From: "Ikramullah, Ikram (fi241c)" Date: Thu, 5 Nov 2020 01:50:41 -0500 Subject: Fix for VID-890 VID was using sed based replacement for the environment variables exposed to its scripts. This was causing many issus with special characters. This has been fixed. Issue-ID: VID-890 Change-Id: I17fb9621bd5b1e6f4b7278df1fd77c617ce9a26d Signed-off-by: Ikramullah, Ikram --- deliveries/src/main/scripts/localize.sh | 31 ------------------- deliveries/src/main/scripts/localize_asdc.sh | 17 ---------- deliveries/src/main/scripts/localize_cache.sh | 15 --------- deliveries/src/main/scripts/localize_log4j.sh | 19 ------------ deliveries/src/main/scripts/localize_portal.sh | 23 -------------- deliveries/src/main/scripts/localize_quartz.sh | 20 ------------ deliveries/src/main/scripts/localize_system.sh | 43 -------------------------- deliveries/src/main/scripts/localize_war.sh | 26 ---------------- deliveries/src/main/scripts/start.sh | 9 ++++++ 9 files changed, 9 insertions(+), 194 deletions(-) delete mode 100755 deliveries/src/main/scripts/localize.sh delete mode 100755 deliveries/src/main/scripts/localize_asdc.sh delete mode 100755 deliveries/src/main/scripts/localize_cache.sh delete mode 100755 deliveries/src/main/scripts/localize_log4j.sh delete mode 100755 deliveries/src/main/scripts/localize_portal.sh delete mode 100755 deliveries/src/main/scripts/localize_quartz.sh delete mode 100755 deliveries/src/main/scripts/localize_system.sh delete mode 100755 deliveries/src/main/scripts/localize_war.sh create mode 100755 deliveries/src/main/scripts/start.sh (limited to 'deliveries/src/main/scripts') diff --git a/deliveries/src/main/scripts/localize.sh b/deliveries/src/main/scripts/localize.sh deleted file mode 100755 index e4b8c220d..000000000 --- a/deliveries/src/main/scripts/localize.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -fillTemplateProperties() { - source /tmp/vid/localize_war.sh $1 || { - echo "ERROR: Localization script failed" - exit 2 - } -} - -createWritableLogbackConfig() { - # Create logback.xml in /tmp/vid/ - # /tmp/logback.xml is owned by root and unmodifiable - cp -f /tmp/logback.xml /tmp/vid/logback.xml -} - -if [ "${ON_KUBERNETES}" = "TRUE" ] -then - echo "We're running on Kubernetes, preconfiguration is already handled" -else - createWritableLogbackConfig - TEMPLATES_BASE_DIR=/usr/local/tomcat/webapps/vid/WEB-INF - fillTemplateProperties ${TEMPLATES_BASE_DIR} -fi - -# Set CATALINA_OPTS if not defined previously -# Enables late-evaluation of env variables, such as VID_KEYSTORE_PASSWORD -: "${CATALINA_OPTS:=-Dvid.keystore.password=${VID_KEYSTORE_PASSWORD} -Dvid.keyalias=vid@vid.onap.org -Dvid.keystore.filename=${VID_KEYSTORE_FILENAME} -Dcom.att.eelf.logging.file=logback.xml -Dcom.att.eelf.logging.path=/tmp/vid/}" -echo "CATALINA_OPTS: ${CATALINA_OPTS}" -export CATALINA_OPTS - -catalina.sh run diff --git a/deliveries/src/main/scripts/localize_asdc.sh b/deliveries/src/main/scripts/localize_asdc.sh deleted file mode 100755 index af483186f..000000000 --- a/deliveries/src/main/scripts/localize_asdc.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -FINAL_CONFIG_FILE=$1/conf/asdc.properties -TEMPLATE_CONFIG_FILE=$1/conf/asdc_template.properties - -echo "Localizing the ASDC client configuration" - -sed -e 's ${ASDC_CLIENT_TYPE} '${ASDC_CLIENT_TYPE}' g' \ - -e 's ${ASDC_CLIENT_REST_HOST} '${ASDC_CLIENT_REST_HOST}' g' \ - -e 's ${ASDC_CLIENT_REST_PORT} '${ASDC_CLIENT_REST_PORT}' g' \ - -e 's ${ASDC_CLIENT_REST_PROTOCOL} '${ASDC_CLIENT_REST_PROTOCOL}' g' \ - -e 's/${ASDC_CLIENT_REST_AUTH}/'"${ASDC_CLIENT_REST_AUTH}"'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { - echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" - exit 4 - } - -echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/deliveries/src/main/scripts/localize_cache.sh b/deliveries/src/main/scripts/localize_cache.sh deleted file mode 100755 index 2d676c373..000000000 --- a/deliveries/src/main/scripts/localize_cache.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -FINAL_CONFIG_FILE=$1/classes/cache.ccf -TEMPLATE_CONFIG_FILE=$1/classes/cache_template.ccf - -echo "Localizing the VID cache configuration" - -mkdir -p "${CACHE_DIRECTORY}" - -sed -e 's,${CACHE_DIRECTORY},'${CACHE_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { - echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" - exit 3 - } - -echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/deliveries/src/main/scripts/localize_log4j.sh b/deliveries/src/main/scripts/localize_log4j.sh deleted file mode 100755 index 121f5673a..000000000 --- a/deliveries/src/main/scripts/localize_log4j.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -FINAL_CONFIG_FILE=$1/conf/log4j.properties -TEMPLATE_CONFIG_FILE=$1/conf/log4j_template.properties - -echo "Localizing the VID log4j configuration" - -mkdir -p ${LOG4J_LOGS_DIRECTORY} - -sed -e 's/${LOG4J_LOGLEVEL}/'${LOG4J_LOGLEVEL}'/g' \ - -e 's/${LOG4J_APPENDER}/'${LOG4J_APPENDER}'/g' \ - -e 's,${LOG4J_LOGS_DIRECTORY},'${LOG4J_LOGS_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { - echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" - exit 3 - } - -echo "Localized ${FINAL_CONFIG_FILE} successfully." - - diff --git a/deliveries/src/main/scripts/localize_portal.sh b/deliveries/src/main/scripts/localize_portal.sh deleted file mode 100755 index 947e0e1d0..000000000 --- a/deliveries/src/main/scripts/localize_portal.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -FINAL_CONFIG_FILE=$1/classes/portal.properties -TEMPLATE_CONFIG_FILE=$1/classes/portal_template.properties - -echo "Localizing the VID portal configuration" - -sed -e 's ${VID_WJ_LOGOUT_URL} '${VID_WJ_LOGOUT_URL}' g' \ - -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \ - -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \ - -e 's ${VID_UEB_URL_LIST} '${VID_UEB_URL_LIST}' g' \ - -e 's ${VID_ECOMP_PORTAL_INBOX_NAME} '${VID_ECOMP_PORTAL_INBOX_NAME}' g' \ - -e 's ${VID_DECRYPTION_KEY} '${VID_DECRYPTION_KEY}' g' \ - -e 's ${VID_UEB_APP_KEY} '${VID_UEB_APP_KEY}' g' \ - -e 's ${VID_UEB_APP_SECRET} '${VID_UEB_APP_SECRET}' g' \ - -e 's ${VID_UEB_APP_MAILBOX_NAME} '${VID_UEB_APP_MAILBOX_NAME}' g' \ - -e 's ${VID_UEB_LISTENERS_ENABLE} '${VID_UEB_LISTENERS_ENABLE}' g' \ - -e 's/${VID_UEB_CONSUMER_GROUP}/'${VID_UEB_CONSUMER_GROUP}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { - echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" - exit 4 - } - -echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/deliveries/src/main/scripts/localize_quartz.sh b/deliveries/src/main/scripts/localize_quartz.sh deleted file mode 100755 index e2b3a0adc..000000000 --- a/deliveries/src/main/scripts/localize_quartz.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -FINAL_CONFIG_FILE=$1/conf/quartz.properties -TEMPLATE_CONFIG_FILE=$1/conf/quartz_template.properties - -echo "Localizing the VID quartz configuration" - -sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \ - -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \ - -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \ - -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \ - -e 's/${VID_MYSQL_PASS}/'"$(printf '%q' "${VID_MYSQL_PASS}")"'/g' \ - -e 's/${VID_MYSQL_MAXCONNECTIONS}/'${VID_MYSQL_MAXCONNECTIONS}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { - echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" - exit 4 - } - -echo "Localized ${FINAL_CONFIG_FILE} successfully." - - diff --git a/deliveries/src/main/scripts/localize_system.sh b/deliveries/src/main/scripts/localize_system.sh deleted file mode 100755 index 5061a02b3..000000000 --- a/deliveries/src/main/scripts/localize_system.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -FINAL_CONFIG_FILE=$1/conf/system.properties -TEMPLATE_CONFIG_FILE=$1/conf/system_template.properties - -echo "Localizing the VID system configuration" - -mkdir -p "${VID_MYLOGIN_FEED_DIRECTORY}" - - -sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \ - -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \ - -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \ - -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \ - -e 's/${VID_MYSQL_PASS}/'"$(printf '%q' "${VID_MYSQL_PASS}")"'/g' \ - -e 's ${VID_AAI_URL} '${VID_AAI_URL}' g' \ - -e 's/${AAI_USE_CLIENT_CERT}/'${AAI_USE_CLIENT_CERT}'/g' \ - -e 's/${AAI_VID_UID}/'${AAI_VID_UID}'/g' \ - -e 's/${AAI_VID_PASSWD_X}/'${AAI_VID_PASSWD_X}'/g' \ - -e 's,${AAI_TRUSTSTORE_FILENAME},'${AAI_TRUSTSTORE_FILENAME}',g' \ - -e 's/${AAI_TRUSTSTORE_PASSWD_X}/'${AAI_TRUSTSTORE_PASSWD_X}'/g' \ - -e 's,${AAI_KEYSTORE_FILENAME},'${AAI_KEYSTORE_FILENAME}',g' \ - -e 's/${AAI_KEYSTORE_PASSWD_X}/'${AAI_KEYSTORE_PASSWD_X}'/g' \ - -e 's/${VID_APP_DISPLAY_NAME}/'${VID_APP_DISPLAY_NAME}'/g' \ - -e 's ${VID_ECOMP_SHARED_CONTEXT_REST_URL} '${VID_ECOMP_SHARED_CONTEXT_REST_URL}' g' \ - -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \ - -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \ - -e 's ${VID_MSO_SERVER_URL} '${VID_MSO_SERVER_URL}' g' \ - -e 's/${VID_MSO_USER}/'${VID_MSO_USER}'/g' \ - -e 's/${VID_MSO_PASS}/'${VID_MSO_PASS}'/g' \ - -e 's,${VID_MYLOGIN_FEED_DIRECTORY},'${VID_MYLOGIN_FEED_DIRECTORY}',g' \ - -e 's,${MSO_DME2_CLIENT_TIMEOUT},'${MSO_DME2_CLIENT_TIMEOUT}',g' \ - -e 's,${MSO_DME2_CLIENT_READ_TIMEOUT},'${MSO_DME2_CLIENT_READ_TIMEOUT}',g' \ - -e 's,${MSO_DME2_SERVER_URL},'${MSO_DME2_SERVER_URL}',g' \ - -e 's,${MSO_DME2_ENABLED},'${MSO_DME2_ENABLED}',g' \ - -e 's,${MSO_POLLING_INTERVAL_MSECS},'${MSO_POLLING_INTERVAL_MSECS}',g' \ - -e 's,${VID_TRUSTSTORE_FILE},'${VID_TRUSTSTORE_FILENAME}',g' \ - -e 's/${VID_TRUSTSTORE_PASS}/'${VID_TRUSTSTORE_PASSWORD}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { - echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" - exit 4 - } - -echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/deliveries/src/main/scripts/localize_war.sh b/deliveries/src/main/scripts/localize_war.sh deleted file mode 100755 index 29cdc5137..000000000 --- a/deliveries/src/main/scripts/localize_war.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -source /tmp/vid/localize_portal.sh $1 || { - echo "ERROR: Localizing portal.properties failed" - exit 1 -} - -source /tmp/vid/localize_quartz.sh $1 || { - echo "ERROR: Localizing quartz.properties failed" - exit 1 -} - -source /tmp/vid/localize_system.sh $1 || { - echo "ERROR: Localizing system.properties failed" - exit 1 -} - -source /tmp/vid/localize_cache.sh $1 || { - echo "ERROR: Localizing cache.ccf failed" - exit 1 -} - -source /tmp/vid/localize_asdc.sh $1 || { - echo "ERROR: Localizing asdc.properties failed" - exit 1 -} diff --git a/deliveries/src/main/scripts/start.sh b/deliveries/src/main/scripts/start.sh new file mode 100755 index 000000000..6c76ce3ca --- /dev/null +++ b/deliveries/src/main/scripts/start.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Set CATALINA_OPTS if not defined previously +# Enables late-evaluation of env variables, such as VID_KEYSTORE_PASSWORD +: "${CATALINA_OPTS:=-Dvid.keystore.password=${VID_KEYSTORE_PASSWORD} -Dvid.keyalias=vid@vid.onap.org -Dvid.keystore.filename=${VID_KEYSTORE_FILENAME} -Dcom.att.eelf.logging.file=logback.xml -Dcom.att.eelf.logging.path=/tmp/vid/}" +echo "CATALINA_OPTS: ${CATALINA_OPTS}" +export CATALINA_OPTS + +catalina.sh run -- cgit 1.2.3-korg