ocket8888 commented on a change in pull request #2714: Tm script improvements
URL: https://github.com/apache/trafficcontrol/pull/2714#discussion_r211337269
##########
File path: infrastructure/cdn-in-a-box/traffic_monitor/run.sh
##########
@@ -59,64 +59,63 @@ sed -ie "s;MY_GATEWAY;$GATEWAY;g" /server.json
sed -ie "s;MY_NETMASK;$NETMASK;g" /server.json
sed -ie "s;MY_IP;$IP;g" /server.json
-while ! curl -sk $TO_URL/api/1.3/ping </dev/null; do
- echo "waiting for $TO_HOST:$TO_PORT"
+source /to-access.sh
+
+while ! to-ping; do
+ echo "waiting for traffic_ops..."
sleep 3
done
-RESPONSE=$(curl -sk -d '{ "u":"'"$TM_USER"'", "p":"'"$TM_PASSWORD"'" }'
$TO_URL/api/1.3/user/login)
-while [[ "$RESPONSE" == '{"alerts":[{"text":"Invalid username or
password.","level":"error"}]}' ]]; do
- echo "Waiting for availability of $TM_USER login"
- RESPONSE=$(curl -sk -d '{ "u":"'"$TM_USER"'", "p":"'"$TM_PASSWORD"'" }'
$TO_URL/api/1.3/user/login)
+# There's a race condition with setting the TM credentials and TO actually
creating
+# the TM user
+while [[ -z "$(to-get api/1.3/users | grep $TM_USER )" ]]; do
Review comment:
Does the `users` endpoint support a `username` query param? [The
docs](https://traffic-control-cdn.readthedocs.io/en/latest/api/v12/user.html#api-1-2-users)
say it only takes an optional `tenant` param.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services