]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: run-backend-api-request.sh: support for JTW tokens
authorRicardo Dias <rdias@suse.com>
Tue, 3 Jul 2018 10:33:33 +0000 (11:33 +0100)
committerRicardo Dias <rdias@suse.com>
Mon, 29 Oct 2018 15:47:14 +0000 (15:47 +0000)
Signed-off-by: Ricardo Dias <rdias@suse.com>
src/pybind/mgr/dashboard/run-backend-api-request.sh

index 1dad7d636d281e538842d4330185005c4f2d9b78..5c4c155943bef767b1fa36f19d79ef0168c64525 100755 (executable)
@@ -9,12 +9,15 @@ if [ "$API_URL" = "null" ]; then
 fi
 cd $CURR_DIR
 
-curl --insecure  -s -c /tmp/cd-cookie.txt -H "Content-Type: application/json" -X POST -d '{"username":"admin","password":"admin"}'  $API_URL/api/auth > /dev/null
+TOKEN=`curl --insecure -s -H "Content-Type: application/json" -X POST \
+            -d '{"username":"admin","password":"admin"}'  $API_URL/api/auth \
+                       | jq .token | sed -e 's/"//g'`
 
 echo "METHOD: $1"
 echo "URL: ${API_URL}${2}"
 echo "DATA: $3"
 echo ""
 
-curl --insecure -s -b /tmp/cd-cookie.txt -H "Content-Type: application/json" -X $1 -d "$3" ${API_URL}$2 | jq
+curl --insecure -s -b /tmp/cd-cookie.txt -H "Authorization: Bearer $TOKEN " \
+        -H "Content-Type: application/json" -X $1 -d "$3" ${API_URL}$2 | jq