diff options
author | 2020-02-29 22:17:05 -0500 | |
---|---|---|
committer | 2020-03-03 13:20:06 -0500 | |
commit | 3a27813b663c34df52b2b1b50df7f0754dcfe134 (patch) | |
tree | 1f962778cd649286f70ae7ec8dbc5d868a668a7b /aai-resources/src/main/scripts/install/addManualData.sh | |
parent | 50315fe106b88e0cd556b8b6fab1dbdd4c9856a4 (diff) |
Update resources to use aai-common changes
Issue-ID: AAI-2750
Change-Id: I33ea2b3d7b4b706edc59c3d45c9957d05effd306
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
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"; |