Created
October 16, 2015 18:33
-
-
Save withinboredom/989a801d2d5d8c52b8bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAgents() { | |
getIp "nginx" | |
echo "$dockerip www.thecassinagroup.dev" >> /etc/hosts | |
retry=10 | |
while [ true ] | |
do | |
retry=$(expr $retry - 1) | |
if [ "$retry" == "0" ] | |
then | |
echo "Unable to get agent subdomains, this might be a missing or incorrect hosts entry" | |
return | |
fi | |
status=$(curl --max-time 10 -sL -w "%{http_code}\\n" "http://$tenantId/api/agents?json=true&retry=$retry" -o /dev/null) | |
if [ "$status" == "200" ] | |
then | |
break | |
fi | |
echo "site not available yet, trying again after 10s, got code: $status" | |
sleep 10 | |
done | |
echo "Retrieving agents..." | |
curl -so agents.json --verbose http://$tenantId/api/agents/?json=true\&retry=$retry | |
echo "Processing agents..." | |
echo | |
cat agents.json | jq --raw-output '.[][].Alias' | while read agent | |
do | |
echo "$DISPLAYIP $agent${tenantId#www}" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment