summaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/main/scripts/putTool.sh
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2018-02-06 15:06:44 -0500
committerVenkata Harish K Kajur <vk250x@att.com>2018-03-07 10:02:36 -0500
commita0d3e8ee8d78d41e4a58437983bc4c894d0024df (patch)
tree37f4698a9481349548eec326f2845f8cb1abd06f /aai-traversal/src/main/scripts/putTool.sh
parente688a3115c5de57ca9ac3e218fad6ecb50d6f8b1 (diff)
Update traversal from AJSC 2 to Spring Boot
Issue-ID: AAI-799 Change-Id: I6500f661db704726f529f665203a9c0605e8193e Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
Diffstat (limited to 'aai-traversal/src/main/scripts/putTool.sh')
-rw-r--r--aai-traversal/src/main/scripts/putTool.sh35
1 files changed, 5 insertions, 30 deletions
diff --git a/aai-traversal/src/main/scripts/putTool.sh b/aai-traversal/src/main/scripts/putTool.sh
index be273a2..6630d8f 100644
--- a/aai-traversal/src/main/scripts/putTool.sh
+++ b/aai-traversal/src/main/scripts/putTool.sh
@@ -22,14 +22,9 @@
#
#
-<<<<<<< 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.
@@ -51,8 +46,6 @@ contains() {
fi
}
-<<<<<<< HEAD
-=======
display_usage() {
cat <<EOF
Usage: $0 [options]
@@ -70,7 +63,6 @@ if [ $# -eq 0 ]; then
exit 1
fi
->>>>>>> codecloud/release/1802
# remove leading slash when present
RESOURCE=`echo $1 | sed "s,^/,,"`
if [ -z $RESOURCE ]; then
@@ -98,12 +90,10 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-traversal
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/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
@@ -116,7 +106,6 @@ if [ ${#} -ne 3 ]; then
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
@@ -143,26 +132,19 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
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
+ curl --request PUT -sL -k $AUTHSTRING -H "Content-Type: application/json" -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`
+ result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "Content-Type: application/json" -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 ]]
@@ -191,18 +173,11 @@ 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