]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: added script to execute backend API requests
authorRicardo Dias <rdias@suse.com>
Mon, 26 Mar 2018 11:02:41 +0000 (12:02 +0100)
committerRicardo Dias <rdias@suse.com>
Fri, 13 Apr 2018 14:58:46 +0000 (15:58 +0100)
Example of usage:

```
$ ./run-backend-api-request.sh POST /api/rbd '{"name": "myimage2", "pool_name": "rbd", "size": 53687091200, "obj_size": 4194304, "features": ["exclusive-lock", "journaling", "layering"], "stripe_unit": null, "stripe_count": null, "data_pool": null}'

$ ./run-backend-api-request.sh GET /api/rbd
```

Signed-off-by: Ricardo Dias <rdias@suse.com>
src/pybind/mgr/dashboard/run-backend-api-request.sh [new file with mode: 0755]

diff --git a/src/pybind/mgr/dashboard/run-backend-api-request.sh b/src/pybind/mgr/dashboard/run-backend-api-request.sh
new file mode 100755 (executable)
index 0000000..2887674
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+CURR_DIR=`pwd`
+cd ../../../../build
+API_URL=`./bin/ceph mgr services 2>/dev/null | jq .dashboard | sed -e 's/"//g' -e 's!/$!!g'`
+cd $CURR_DIR
+
+curl -s -c /tmp/cd-cookie.txt -H "Content-Type: application/json" -X POST -d '{"username":"admin","password":"admin"}'  $API_URL/api/auth > /dev/null
+
+echo "API_ENDPOINT: $API_URL"
+echo "METHOD: $1"
+echo "PATH: $2"
+echo "DATA: $3"
+echo ""
+
+curl -s -b /tmp/cd-cookie.txt -H "Content-Type: application/json" -X $1 -d "$3" ${API_URL}$2 | jq