diff --git a/register_vms.sh b/register_vms.sh index 0b14d8f..2f57fe6 100644 --- a/register_vms.sh +++ b/register_vms.sh @@ -5,7 +5,8 @@ declare -gr OS_PROJECT=$1 declare -gr WIN_PROJECT=$2 declare -gr API_TOKEN=$3 declare -g RD_JOB_ID=$4 -declare -g RD_EXEC_ID=$5 +#declare -g RD_EXEC_ID=$5 +declare -g RD_EXEC_ID=$(cat /deployments/$OS_PROJECT-$WIN_PROJECT/EXEC_ID) export OS_CLIENT_CONFIG_FILE=/deployments/$OS_PROJECT-$WIN_PROJECT/clouds.yaml @@ -26,10 +27,12 @@ initialize_json() { "job_id": "'$RD_JOB_ID'", "execution_id": "'$RD_EXEC_ID'", "status": "ok", - "DC": {}, - "WB": {"load_balancer": true, VM: []}, - "APP": {"load_balancer": false, VM: []}, - "GPU": {"load_balancer": false, VM: []} + "data": { + "DC": {}, + "WB": {"load_balancer": true, VM: []}, + "APP": {"load_balancer": false, VM: []}, + "GPU": {"load_balancer": false, VM: []} + } }' > $OUTPUT_FILE declare -g -r VM_JSON="/deployments/$OS_PROJECT-$WIN_PROJECT/data.json" } @@ -42,16 +45,16 @@ add_vm() { declare -r TYPE=$4 if [[ $TYPE == "DC" ]]; then - jq ".${TYPE} += {\"name\": \"${NAME}\", \"ip\": \"${IP}\", \"uuid\": \"${UUID}\"}" $VM_JSON > temp.json + jq ".data.${TYPE} += {\"name\": \"${NAME}\", \"ip\": \"${IP}\", \"uuid\": \"${UUID}\"}" $VM_JSON > temp.json mv -f temp.json $VM_JSON else - jq ".${TYPE}.VM += [{\"name\": \"${NAME}\", \"ip\": \"${IP}\", \"uuid\": \"${UUID}\"}]" $VM_JSON > temp.json + jq ".data.${TYPE}.VM += [{\"name\": \"${NAME}\", \"ip\": \"${IP}\", \"uuid\": \"${UUID}\"}]" $VM_JSON > temp.json mv -f temp.json $VM_JSON fi } post_request() { - declare -r API_ENDPOINT='https://projects.eidf.ac.uk/testportal/job/api/notification' + declare -r API_ENDPOINT='https://portal.eidf.ac.uk/job/api/notification' jq -c . $VM_JSON curl \ -X POST \