From e32d0fac919c8cc5657496a16c300877bd29621e Mon Sep 17 00:00:00 2001 From: jhh Date: Thu, 25 Apr 2019 07:45:29 -0500 Subject: Match up ControlLoopParams against ToscaPolicy Change-Id: Ia23a5b90b452bcafe2a8aa660598697ebfb07431 Issue-ID: POLICY-1691 Signed-off-by: jhh --- .../src/main/docker/docker-entrypoint.sh | 50 ++++++++++++++++++++-- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'controlloop/packages/docker-controlloop') diff --git a/controlloop/packages/docker-controlloop/src/main/docker/docker-entrypoint.sh b/controlloop/packages/docker-controlloop/src/main/docker/docker-entrypoint.sh index 8afc2c0db..73781619e 100644 --- a/controlloop/packages/docker-controlloop/src/main/docker/docker-entrypoint.sh +++ b/controlloop/packages/docker-controlloop/src/main/docker/docker-entrypoint.sh @@ -25,6 +25,10 @@ function configurations { local confName + if ! ls "${POLICY_INSTALL_INIT}"/*.conf 2>&1; then + return 0 + fi + for c in $(ls "${POLICY_INSTALL_INIT}"/*.conf 2> /dev/null); do echo "adding configuration file: ${c}" cp -f "${c}" "${POLICY_HOME}"/etc/profile.d/ @@ -41,6 +45,10 @@ function features { set -x fi + if ! ls "${POLICY_INSTALL_INIT}"/features*.zip 2>&1; then + return 0 + fi + source "${POLICY_HOME}"/etc/profile.d/env.sh for f in $(ls "${POLICY_INSTALL_INIT}"/features*.zip 2> /dev/null); do @@ -55,6 +63,10 @@ function scripts { set -x fi + if ! ls "${POLICY_INSTALL_INIT}"/*.sh 2>&1; then + return 0 + fi + source "${POLICY_HOME}"/etc/profile.d/env.sh for s in $(ls "${POLICY_INSTALL_INIT}"/*.sh 2> /dev/null); do @@ -97,6 +109,10 @@ function properties { set -x fi + if ! ls "${POLICY_INSTALL_INIT}"/*.properties 2>&1; then + return 0 + fi + for p in $(ls "${POLICY_INSTALL_INIT}"/*.properties 2> /dev/null); do echo "configuration properties: ${p}" cp -f "${p}" "${POLICY_HOME}"/config @@ -113,6 +129,9 @@ function db { return 0 fi + echo "Wating for ${SQL_HOST} ." + timeout 120 bash -c 'until nc -vz "${SQL_HOST}" 3306; do echo -n "."; sleep 1; done'; echo $? + "${POLICY_HOME}"/bin/db-migrator -s ALL -o upgrade } @@ -200,7 +219,17 @@ function start { policy start } -function boot { +function configure { + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} --" + set -x + fi + + reload + db +} + +function vmBoot { if [[ ${DEBUG} == y ]]; then echo "-- ${FUNCNAME[0]} --" set -x @@ -209,12 +238,21 @@ function boot { reload db start +} + +function dockerBoot { + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} --" + set -x + fi + + set -e + + vmBoot tail -f /dev/null } -set -e - if [[ ${DEBUG} == y ]]; then echo "-- $0 $* --" set -x @@ -224,7 +262,11 @@ operation="${1}" case "${operation}" in inspect) inspect ;; - boot) boot + boot) dockerBoot + ;; + vmboot) vmBoot + ;; + configure) configure ;; *) exec "$@" ;; -- cgit 1.2.3-korg