]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/run-backend-api-request.sh
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / run-backend-api-request.sh
1 #!/bin/bash
2
3 CURR_DIR=`pwd`
4 cd ../../../../build
5 API_URL=`./bin/ceph mgr services 2>/dev/null | jq .dashboard | sed -e 's/"//g' -e 's!/$!!g'`
6 if [ "$API_URL" = "null" ]; then
7 echo "Couldn't retrieve API URL, exiting..." >&2
8 exit 1
9 fi
10 cd $CURR_DIR
11
12 TOKEN=`curl --insecure -s -H "Content-Type: application/json" -X POST \
13 -d '{"username":"admin","password":"admin"}' $API_URL/api/auth \
14 | jq .token | sed -e 's/"//g'`
15
16 echo "METHOD: $1"
17 echo "URL: ${API_URL}${2}"
18 echo "DATA: $3"
19 echo ""
20
21 curl --insecure -s -b /tmp/cd-cookie.txt -H "Authorization: Bearer $TOKEN " \
22 -H "Content-Type: application/json" -X $1 -d "$3" ${API_URL}$2 | jq
23