diff options
Diffstat (limited to 'aai-resources/src/main/scripts/install/addManualData.sh')
-rw-r--r-- | aai-resources/src/main/scripts/install/addManualData.sh | 85 |
1 files changed, 55 insertions, 30 deletions
diff --git a/aai-resources/src/main/scripts/install/addManualData.sh b/aai-resources/src/main/scripts/install/addManualData.sh index 016c5c3..bd7f7bd 100644 --- a/aai-resources/src/main/scripts/install/addManualData.sh +++ b/aai-resources/src/main/scripts/install/addManualData.sh @@ -75,41 +75,66 @@ error_exit () { rel="/"$1"/" k=0 -TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/*/*.txt -COMMAND=`ls ${TEXT_PATH} | sort -f` - -ls ${TEXT_PATH} >/dev/null 2>&1 -if [ $? -ne 0 ] +if [ "$1" = "tenant_isolation" ] then -echo "No manual data to add for $1"; -exit 0; + COMPLEX_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/complex -name "*.txt" -print | sort -f` + ZONE_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/zone -name "*.txt" -print | sort -f` + CR_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/cloud-region -name "*.txt" -print | sort -f` + TENANT_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/tenant -name "*.txt" -print | sort -f` + AZ_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/availability-zone -name "*.txt" -print | sort -f` + PSERVER_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/pserver -name "*.txt" -print | sort -f` + CUSTOMER_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/customer -name "*.txt" -print | sort -f` + SERVICESUB_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/service-subscription -name "*.txt" -print | sort -f` + SERVICE_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/service -name "*.txt" -print | sort -f` + + TEXT_PATH="${COMPLEX_TEXT_PATH} ${ZONE_TEXT_PATH} ${CR_TEXT_PATH} ${CUSTOMER_TEXT_PATH} ${SERVICE_TEXT_PATH} ${SERVICESUB_TEXT_PATH} ${TENANT_TEXT_PATH} ${AZ_TEXT_PATH} ${PSERVER_TEXT_PATH}" + COMMAND=${TEXT_PATH} +elif [ "$1" = "vm_export" ] +then + TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/vm_export/*.txt + COMMAND=`ls ${TEXT_PATH} | sort -rf` +else + TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/*/*.txt + COMMAND=`ls ${TEXT_PATH} | sort -f` fi +#ls ${TEXT_PATH} >/dev/null 2>&1 +#if [ $? -ne 0 ] +#then +#echo "No manual data to add for $1"; +#exit 0; +#fi + for filepath in ${COMMAND} do -contains $filepath $rel -if [ $? -eq 0 ] -then -jsonfile=${filepath%???}json -j=0 -while IFS=\n read -r i -do -echo "##### Begin putTool for $i ##### from file $filepath" | tee -a $OUTFILE -resource=`echo $i | tr -d '\r'` -errorcode=412 -$PROJECT_HOME/scripts/putTool.sh $resource $jsonfile $errorcode 1 0 na 1 >> $OUTFILE 2>&1 || error_exit "$resource" $j $filepath -echo "##### End putTool for $resource #####" | tee -a $OUTFILE -echo "Begin getTool for $resource" | tee -a $OUTFILE -$PROJECT_HOME/scripts/getTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$i" $j $filepath -echo "End getTool for $resource" | tee -a $OUTFILE - -j=$(expr "$j" + 1) -k=$(expr "$k" + 1) -done < $filepath - -fi - -done + echo "File path ${filepath}" + contains $filepath $rel + if [ $? -eq 0 ] + then + jsonfile=${filepath%???}json + j=0 + while IFS=\n read -r i + do + echo "##### Begin putTool for $i ##### from file $filepath" | tee -a $OUTFILE + resource=`echo $i | tr -d '\r'` + errorcode=412 + $PROJECT_HOME/scripts/putTool.sh $resource $jsonfile $errorcode >> $OUTFILE 2>&1 || error_exit "$resource" $j $filepath + echo "##### End putTool for $resource #####" | tee -a $OUTFILE + contains $resource "relationship-list" + if [ $? -eq 0 ] + then + echo "skip getTool for $resource" | tee -a $OUTFILE + else + echo "Begin getTool for $resource" | tee -a $OUTFILE + $PROJECT_HOME/scripts/getTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$i" $j $filepath + echo "End getTool for $resource" | tee -a $OUTFILE + fi + + j=$(expr "$j" + 1) + k=$(expr "$k" + 1) + done < $filepath + fi + done if [ $k -eq 0 ] then echo "No manual data to add for release $1"; |