From 69acadf78d77d565f776445cc0eefbebf009396f Mon Sep 17 00:00:00 2001 From: Michael Mraka Date: Fri, 13 Dec 2024 14:22:55 +0100 Subject: [PATCH] RHINENG-14351: fix candlepin API status handling fixes 2024/12/13 12:34:43 [Recovery] 2024/12/13 - 12:34:43 panic recovered: runtime error: invalid memory address or nil pointer dereference /go/pkg/mod/github.com/gin-contrib/timeout@v1.0.1/timeout.go:63 (0x1182204) /go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185 (0xbdacca) --- manager/controllers/template_systems_update.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manager/controllers/template_systems_update.go b/manager/controllers/template_systems_update.go index 1b9d501e8..284c74796 100644 --- a/manager/controllers/template_systems_update.go +++ b/manager/controllers/template_systems_update.go @@ -185,8 +185,10 @@ func callCandlepin(ctx context.Context, consumer string, request *candlepin.Cons statusCode := utils.TryGetStatusCode(resp) utils.LogDebug("request", *request, "candlepin_url", candlepinEnvConsumersURL, "status_code", statusCode, "err", err) - if err != nil || statusCode != http.StatusOK { + if err != nil { err = errors.Wrap(errCandlepin, err.Error()) + } else if statusCode != http.StatusOK && statusCode != http.StatusNoContent { + err = errors.Errorf("candlepin API status %d", statusCode) } return &candlepinResp, resp, err }