From b22945e185d362e14058c8f33b7ac9fa74501016 Mon Sep 17 00:00:00 2001 From: Romain Date: Tue, 5 Apr 2022 15:54:07 +0200 Subject: [PATCH] Remove duplicate error logs --- pkg/provider/ecs/ecs.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkg/provider/ecs/ecs.go b/pkg/provider/ecs/ecs.go index 907a6a88a..13dafd8d8 100644 --- a/pkg/provider/ecs/ecs.go +++ b/pkg/provider/ecs/ecs.go @@ -263,8 +263,7 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI return !lastPage }) if err != nil { - logger.Error("Unable to list tasks") - return nil, err + return nil, fmt.Errorf("listing tasks: %w", err) } // Skip to the next cluster if there are no tasks found on @@ -370,7 +369,6 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI } func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, clusterName *string, ecsDatas map[string]*ecs.Task) (map[string]*ec2.Instance, error) { - logger := log.FromContext(ctx) instanceIds := make(map[string]string) ec2Instances := make(map[string]*ec2.Instance) @@ -389,8 +387,7 @@ func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, cl Cluster: clusterName, }) if err != nil { - logger.Errorf("Unable to describe container instances: %v", err) - return nil, err + return nil, fmt.Errorf("describing container instances: %w", err) } for _, container := range resp.ContainerInstances { @@ -418,8 +415,7 @@ func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, cl return !lastPage }) if err != nil { - logger.Errorf("Unable to describe instances: %v", err) - return nil, err + return nil, fmt.Errorf("describing instances: %w", err) } } } @@ -440,8 +436,7 @@ func (p *Provider) lookupTaskDefinitions(ctx context.Context, client *awsClient, TaskDefinition: task.TaskDefinitionArn, }) if err != nil { - logger.Errorf("Unable to describe task definition: %v", err) - return nil, err + return nil, fmt.Errorf("describing task definition: %w", err) } taskDef[arn] = resp.TaskDefinition