From 39798ae5bf66148b3b76b27cba63eb1f086f38c7 Mon Sep 17 00:00:00 2001 From: Michael Mraka Date: Tue, 10 Sep 2024 13:32:34 +0200 Subject: [PATCH] RHINENG-9505: use individual contex for candlepin call --- manager/controllers/template_systems_delete.go | 2 +- manager/controllers/template_systems_update.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manager/controllers/template_systems_delete.go b/manager/controllers/template_systems_delete.go index 0770eef22..c00eba7f2 100644 --- a/manager/controllers/template_systems_delete.go +++ b/manager/controllers/template_systems_delete.go @@ -40,7 +40,7 @@ func TemplateSystemsDeleteHandler(c *gin.Context) { return } - err = assignCandlepinEnvironment(c, db, account, nil, req.Systems, groups) + err = assignCandlepinEnvironment(db, account, nil, req.Systems, groups) if err != nil { return } diff --git a/manager/controllers/template_systems_update.go b/manager/controllers/template_systems_update.go index bea2c3350..25e0d7b47 100644 --- a/manager/controllers/template_systems_update.go +++ b/manager/controllers/template_systems_update.go @@ -65,7 +65,7 @@ func TemplateSystemsUpdateHandler(c *gin.Context) { return } - err = assignCandlepinEnvironment(c, db, account, &template.EnvironmentID, req.Systems, groups) + err = assignCandlepinEnvironment(db, account, &template.EnvironmentID, req.Systems, groups) if err != nil { return } @@ -193,7 +193,7 @@ func callCandlepin(ctx context.Context, consumer string, request *candlepin.Cons return candlepinRespPtr.(*candlepin.ConsumersUpdateResponse), nil } -func assignCandlepinEnvironment(c context.Context, db *gorm.DB, accountID int, env *string, inventoryIDs []string, +func assignCandlepinEnvironment(db *gorm.DB, accountID int, env *string, inventoryIDs []string, groups map[string]string) error { var consumers = []struct { InventoryID string @@ -219,7 +219,7 @@ func assignCandlepinEnvironment(c context.Context, db *gorm.DB, accountID int, e err = errors2.Join(err, errors.Errorf("Missing owner_id for '%s'", consumer.InventoryID)) continue } - resp, apiErr := callCandlepin(c, *consumer.Consumer, &updateReq) + resp, apiErr := callCandlepin(base.Context, *consumer.Consumer, &updateReq) // check response if apiErr != nil { err = errors2.Join(err, apiErr, errors.New(resp.Message))