Fix and simplify tag repo existence checks

The current implementation is over-complicated and clearly flawed. The full output of the curl command before grep is applied has several unpredictable digit strings, most notably:

X-Varnish: 248056622 246047235

If 200, 403 or 404 happen to appear in one of these digit strings we will decide the repo does not exist (because the stdout of the curl | grep command will not be exactly "200") and refuse to add it.

If we drop 403 and 404 from the grep (as we could, since we do nothing with them), we solve the problem of false failing if '403' or '404' appears in a digit string, but add a possibility of false succeeding if the status code is 403 or 404, but 200 appears (once) in a digit string.

Since curl already has all the features we need, let's just use them: --retry and --retry-delay to set the retry count and delay, and -f to exit non-zero if the HTTP status code is 400 or higher.

Signed-off-by: Adam Williamson awilliam@redhat.com

Edited by Adam Williamson

Merge request reports

Loading