blob: 8ae9f385e7b1d8ccf256df2985bb6c7d4efb550b [file] [log] [blame]
Alexb00fee12022-02-17 14:20:04 -06001#!/bin/bash
2if [[ -z ${token+x} ]]; then
3 export token=$(openstack token issue -c id -f value)
4 echo "# Exported token: ${token}"
5fi
6if [[ -z ${project_id+x} ]]; then
7 export project_id=$(openstack project list -c ID -c Name -f value | grep ${OS_PROJECT_NAME} | cut -d' ' -f1)
8 echo "# Exported project_id: ${project_id}"
9fi
Alexc7f187c2022-04-28 10:02:27 -050010#poke_uri=$(echo ${1/project_id/$project_id})
Alexb00fee12022-02-17 14:20:04 -060011
12function ppoke {
Alexc7f187c2022-04-28 10:02:27 -050013rr=$(curl -sSH "X-Auth-Token: ${token}" $1 2>&1)
Alexb00fee12022-02-17 14:20:04 -060014if [[ $? != 0 ]]; then
Alexc7f187c2022-04-28 10:02:27 -050015 printf "[$(date +'%H:%M:%S')] -> $1\nError: $rr\n\n"
Alexb00fee12022-02-17 14:20:04 -060016else
Alexc7f187c2022-04-28 10:02:27 -050017 printf "[$(date +'%H:%M:%S')] -> '$1', $(echo $rr | wc -c) bytes\n"
Alexb00fee12022-02-17 14:20:04 -060018fi
19}
20
Alexc7f187c2022-04-28 10:02:27 -050021cc=${2};
Alexb00fee12022-02-17 14:20:04 -060022while [[ $cc -gt 0 ]]; do
23 cat $1 | while read svc; do
Alexc7f187c2022-04-28 10:02:27 -050024 ppoke $svc;
Alexb00fee12022-02-17 14:20:04 -060025 done
26 (( cc -= 1 ));
27 echo "$cc to go";
28 sleep 0.1;
29done