mirror of
https://github.com/minio/minio.git
synced 2025-05-21 17:43:48 -04:00
do not panic if DNS_WEBHOOK_ENDPOINT is not reachable (#13265)
This commit is contained in:
parent
32df742b85
commit
9a27c4a2f0
@ -90,16 +90,19 @@ func (c *OperatorDNS) Put(bucket string) error {
|
|||||||
if err = c.addAuthHeader(req); err != nil {
|
if err = c.addAuthHeader(req); err != nil {
|
||||||
return newError(bucket, err)
|
return newError(bucket, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.httpClient.Do(req)
|
resp, err := c.httpClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if derr := c.Delete(bucket); derr != nil {
|
if derr := c.Delete(bucket); derr != nil {
|
||||||
return newError(bucket, derr)
|
return newError(bucket, derr)
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
defer xhttp.DrainBody(resp.Body)
|
||||||
|
|
||||||
|
if resp.StatusCode != http.StatusOK {
|
||||||
var errorStringBuilder strings.Builder
|
var errorStringBuilder strings.Builder
|
||||||
io.Copy(&errorStringBuilder, io.LimitReader(resp.Body, resp.ContentLength))
|
io.Copy(&errorStringBuilder, io.LimitReader(resp.Body, resp.ContentLength))
|
||||||
xhttp.DrainBody(resp.Body)
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
|
||||||
errorString := errorStringBuilder.String()
|
errorString := errorStringBuilder.String()
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case http.StatusConflict:
|
case http.StatusConflict:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user