Fix git clone issue to fail container startup 17/16817/1
authorVenkata Harish K Kajur <vk250x@att.com>
Mon, 2 Oct 2017 03:07:55 +0000 (23:07 -0400)
committerVenkata Harish K Kajur <vk250x@att.com>
Mon, 2 Oct 2017 03:08:05 +0000 (23:08 -0400)
Also fix the call to update query script issue
since in kubernetes environment, there is no
guarantee that the haproxy will come up before the
traversal container comes up so we need to modify
aai.server.url to point to resources container

Issue-ID: AAI-408
Change-Id: I46c4e75c10a7509541ea19113a3297de26f92677
Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
aai-traversal/src/main/resources/docker/docker-entrypoint.sh
aai-traversal/src/main/resources/docker/init-chef.sh

index f69e468..0310b24 100644 (file)
@@ -67,9 +67,15 @@ if [ -z ${DISABLE_UPDATE_QUERY} ]; then
 
        UPDATE_QUERY_RAN_FILE="updateQueryRan.txt";
 
+       AAICONFIG_FILE=/opt/app/aai-traversal/bundleconfig/etc/appprops/aaiconfig.properties;
+
        if [ ! -f ${UPDATE_QUERY_RAN_FILE} ]; then
+               OLD_RESOURCES_URL=$(grep -o "^aai.server.url=.*" ${AAICONFIG_FILE} | cut -d"=" -f2-);
+               TEMP_RESOURCES_URL=https://${RESOURCES_HOSTNAME}:${RESOURCES_PORT};
+               sed -i "s%^aai.server.url=.*$%aai.server.url=${TEMP_RESOURCES_URL}%g" ${AAICONFIG_FILE};
                gosu aaiadmin /opt/app/aai-traversal/bin/install/updateQueryData.sh
                touch ${UPDATE_QUERY_RAN_FILE};
+               sed -i "s%^aai.server.url=.*$%aai.server.url=${OLD_RESOURCES_URL}%g" ${AAICONFIG_FILE};
        fi
 fi
 
index 52c35e3..a8802db 100644 (file)
@@ -32,7 +32,7 @@ if [ ! -d "aai-config" ]; then
 
     git clone --depth 1 -b ${CHEF_BRANCH} --single-branch ${CHEF_CONFIG_GIT_URL}/${CHEF_CONFIG_REPO}.git aai-config || {
         echo "Error: Unable to clone the aai-config repo with url: ${CHEF_GIT_URL}/${CHEF_CONFIG_REPO}.git";
-        exit;
+        exit 1;
     }
 
 fi
@@ -49,7 +49,7 @@ if [ ! -d "aai-data" ]; then
 
     git clone --depth 1 -b ${CHEF_BRANCH} --single-branch ${CHEF_DATA_GIT_URL}/aai-data.git aai-data || {
         echo "Error: Unable to clone the aai-data repo with url: ${CHEF_GIT_URL}";
-        exit;
+        exit 1;
     }
 
 fi