Catch GitLab outages in org.cms.WN-basic
In fetch-from-web-GitLab
, add --fail
flag to curl, giving a a non-zero return code for failed downloads.
When GitLab is down, the SAM test returns CRITICAL, rather than WARNING
Adding the --fail
flag to curl will result in a non-zero return code for failed GitLab requests, and should hopefully sort this out.
Curl examples:
A successful curl returns 0, as expected
$ curl http://t2.unl.edu/hello.txt
hello
$ echo $?
0
With an unsuccessful 404, curl also returns 0
$ curl http://t2.unl.edu/goodbye.txt
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /goodbye.txt was not found on this server.</p>
</body></html>
$ echo $?
0
Adding the --fail
flag causes a non-zero return code for the failed attempt
$ curl --fail http://t2.unl.edu/goodbye.txt
curl: (22) The requested URL returned error: 404 Not Found
$ echo $?
22