Rename tower retry script and reframe documentation

This commit is contained in:
Matthew Jones
2014-04-16 10:37:45 -04:00
parent e753260087
commit 8ffdc6de29

View File

@@ -1,16 +1,17 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
echo -e "Retry callback attempt if we don't receive a 202 response from the Tower API\n" echo -e "Requests server configuration from Ansible Tower\n"
echo "Usage: $0 <server address>[:server port] <host config key> <job template id>" echo "Usage: $0 <server address>[:server port] <host config key> <job template id>"
echo "Example: $0 example.towerhost.net 44d7507f2ead49af5fca80aa18fd24bc 38"
exit 1 exit 1
} }
[ $# -lt 3 ] && usage [ $# -lt 3 ] && usage
retry_attempts=5 retry_attempts=10
attempt=0 attempt=0
while [[ $attempt < $retry_attempts ]] while [[ $attempt -lt $retry_attempts ]]
do do
status_code=`curl -s -i --data "host_config_key=$2" http://$1/api/v1/job_templates/$3/callback/ | head -n 1 | awk '{print $2}'` status_code=`curl -s -i --data "host_config_key=$2" http://$1/api/v1/job_templates/$3/callback/ | head -n 1 | awk '{print $2}'`
if [[ $status_code == 202 ]] if [[ $status_code == 202 ]]
@@ -18,7 +19,7 @@ do
exit 0 exit 0
fi fi
attempt=$(( attempt + 1 )) attempt=$(( attempt + 1 ))
echo "${status_code} received... retrying." echo "${status_code} received... retrying in 1 minute. (Attempt ${attempt})"
sleep 5 sleep 60
done done
exit 1 exit 1