mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Include the actuall callback retry script
This commit is contained in:
parent
6b3d857e49
commit
1d28f73687
24
tools/scripts/callback_retry.sh
Normal file
24
tools/scripts/callback_retry.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo -e "Retry callback attempt if we don't receive a 202 response from the Tower API\n"
|
||||
echo "Usage: $0 <server address>[:server port] <host config key> <job template id>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ $# -lt 3 ] && usage
|
||||
|
||||
retry_attempts=5
|
||||
attempt=0
|
||||
while [[ $attempt < $retry_attempts ]]
|
||||
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}'`
|
||||
if [[ $status_code == 202 ]]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
attempt=$(( attempt + 1 ))
|
||||
echo "${status_code} received... retrying."
|
||||
sleep 5
|
||||
done
|
||||
exit 1
|
||||
Loading…
x
Reference in New Issue
Block a user