add data policies

use json structure
This commit is contained in:
Fabian Märki
2016-06-06 15:58:27 +02:00
parent 00c1299726
commit 463e06ffdf
7 changed files with 333 additions and 95 deletions

20
validate.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
HOST="http://sf-dispatcher-api.psi.ch"
# HOST="http://localhost:8080"
HTTP_ADDRESS="/configuration/validate"
RESPONSE=response.json
# see http://stackoverflow.com/questions/18258804/how-to-catch-timeout-errors-in-a-curl-shell-script
COMMAND="curl -s -w %{http_code} -X POST"
while read -r -d '' filename; do
COMMAND+=" -F files=@${filename}"
done < <(find . \( -name "*.sources" -o -name "*.policies" \) -print0)
COMMAND+=" ${HOST}${HTTP_ADDRESS} -o ${RESPONSE}"
# echo "Execute command: "${COMMAND}
STATUS=$(${COMMAND})
cat ${RESPONSE} | python -m json.tool
rm -f ${RESPONSE}
#echo ${STATUS}