From f702ccd5b3f92fabfe21a1d3f3af762b6c628b88 Mon Sep 17 00:00:00 2001 From: Venkata Harish K Kajur Date: Thu, 18 Jan 2018 11:04:20 -0500 Subject: Sync logging context changes Issue-ID: AAI-493 Change-Id: I8c460cce840b4fe46ff4deacbe3a770755a4c677 Signed-off-by: Venkata Harish K Kajur --- aai-traversal/src/main/scripts/deleteNamedQuery.sh | 12 +++++ aai-traversal/src/main/scripts/putTool.sh | 61 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) (limited to 'aai-traversal/src/main/scripts') diff --git a/aai-traversal/src/main/scripts/deleteNamedQuery.sh b/aai-traversal/src/main/scripts/deleteNamedQuery.sh index 16b20a7..2d19a9c 100644 --- a/aai-traversal/src/main/scripts/deleteNamedQuery.sh +++ b/aai-traversal/src/main/scripts/deleteNamedQuery.sh @@ -26,7 +26,11 @@ # PROGNAME=$(basename $0) +<<<<<<< HEAD OUTFILE=$PROJECT_HOME/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d) +======= +OUTFILE=/opt/app/aai-traversal/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d) +>>>>>>> codecloud/release/1802 #OUTFILE=/c/temp/${PROGNAME}.log.$(date +\%Y-\%m-\%d) TS=$(date "+%Y-%m-%d %H:%M:%S") @@ -45,7 +49,11 @@ error_exit () { } j=0 +<<<<<<< HEAD for filepath in `ls $PROJECT_HOME/bundleconfig/etc/scriptdata/named-query-json/*.json|sort -f` +======= +for filepath in `ls /opt/app/aai-traversal/bundleconfig/etc/scriptdata/named-query-json/*.json|sort -f` +>>>>>>> codecloud/release/1802 #for filepath in `ls /c/sources/aai/aaigitnew/bundleconfig-local/etc/scriptdata/named-query-json/*.json|sort -f` do j=$(expr "$j" + 1) @@ -53,7 +61,11 @@ filename=$(basename $filepath) echo "Begin deleteTool for named-query $filename" | tee -a $OUTFILE vers=`grep named-query-uuid $filepath|cut -d':' -f2|cut -d'"' -f2` resource=service-design-and-creation/named-queries/named-query/$vers +<<<<<<< HEAD echo "y" | $PROJECT_HOME/scripts/deleteTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j +======= +echo "y" | /opt/app/aai-traversal/scripts/deleteTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j +>>>>>>> codecloud/release/1802 echo "End deleteTool for named-query $filename" | tee -a $OUTFILE done diff --git a/aai-traversal/src/main/scripts/putTool.sh b/aai-traversal/src/main/scripts/putTool.sh index ea529f1..be273a2 100644 --- a/aai-traversal/src/main/scripts/putTool.sh +++ b/aai-traversal/src/main/scripts/putTool.sh @@ -22,8 +22,14 @@ # # +<<<<<<< HEAD # The script is called with a resource, filepath and an optional argument to # ignore HTTP failure codes which would otherwise indicate a failure. +======= +# The script is called with a resource, filepath, an optional argument to +# ignore HTTP failure codes which would otherwise indicate a failure, +# and an optional argument to display more data. +>>>>>>> codecloud/release/1802 # It invokes a PUT on the resource with the file using curl # Uses aaiconfig.properties for authorization type and url. The HTTP response # code is checked. Responses between 200 and 299 are considered success. @@ -45,6 +51,26 @@ contains() { fi } +<<<<<<< HEAD +======= +display_usage() { + cat < + 2. This script requires two arguments, a resource path and a file path to a json file containing the payload. + 3. Example: query?format=xxxx customquery.json (possible formats are simple, raw, console, count, graphson, id, pathed, resource and resource_and_url) + 4. Adding the optional HTTP Response code will allow the script to ignore HTTP failure codes that match the input parameter. + 5. Adding the optional "-display" argument will display all data returned from the request, instead of just a response code. + +EOF +} +if [ $# -eq 0 ]; then + display_usage + exit 1 +fi + +>>>>>>> codecloud/release/1802 # remove leading slash when present RESOURCE=`echo $1 | sed "s,^/,,"` if [ -z $RESOURCE ]; then @@ -76,6 +102,21 @@ prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc today=$(date +\%Y-\%m-\%d) +<<<<<<< HEAD +======= +RETURNRESPONSE=false +if [ ${#} -ne 2 ]; then + if [ "$3" = "-display" ]; then + RETURNRESPONSE=true + fi +fi +if [ ${#} -ne 3 ]; then + if [ "$4" = "-display" ]; then + RETURNRESPONSE=true + fi +fi + +>>>>>>> codecloud/release/1802 MISSING_PROP=false RESTURL=`grep ^aai.server.url= $prop_file |cut -d'=' -f2 |tr -d "\015"` if [ -z $RESTURL ]; then @@ -106,10 +147,22 @@ if [ $MISSING_PROP = false ]; then else AUTHSTRING="-u $CURLUSER:$CURLPASSWORD" fi +<<<<<<< HEAD result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE` #echo "result is $result." RC=0; if [ $? -eq 0 ]; then +======= + + if [ $RETURNRESPONSE = true ]; then + curl --request PUT -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE | python -mjson.tool + RC=$? + else + result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE` + #echo "result is $result." + RC=0; + if [ $? -eq 0 ]; then +>>>>>>> codecloud/release/1802 case $result in +([0-9])?) #if [[ "$result" -eq 412 || "$result" -ge 200 && $result -lt 300 ]] @@ -138,10 +191,18 @@ if [ $MISSING_PROP = false ]; then ;; esac +<<<<<<< HEAD else echo "FAILED to send request to $RESTURL" RC=-1 fi +======= + else + echo "FAILED to send request to $RESTURL" + RC=-1 + fi + fi +>>>>>>> codecloud/release/1802 else echo "usage: $0 resource file [expected-failure-codes]" RC=-1 -- cgit 1.2.3-korg