Remove duplicate error logs

This commit is contained in:
Romain 2022-04-05 15:54:07 +02:00 committed by GitHub
parent 4b755dc58d
commit b22945e185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -263,8 +263,7 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
return !lastPage return !lastPage
}) })
if err != nil { if err != nil {
logger.Error("Unable to list tasks") return nil, fmt.Errorf("listing tasks: %w", err)
return nil, err
} }
// Skip to the next cluster if there are no tasks found on // 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) { 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) instanceIds := make(map[string]string)
ec2Instances := make(map[string]*ec2.Instance) ec2Instances := make(map[string]*ec2.Instance)
@ -389,8 +387,7 @@ func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, cl
Cluster: clusterName, Cluster: clusterName,
}) })
if err != nil { if err != nil {
logger.Errorf("Unable to describe container instances: %v", err) return nil, fmt.Errorf("describing container instances: %w", err)
return nil, err
} }
for _, container := range resp.ContainerInstances { for _, container := range resp.ContainerInstances {
@ -418,8 +415,7 @@ func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, cl
return !lastPage return !lastPage
}) })
if err != nil { if err != nil {
logger.Errorf("Unable to describe instances: %v", err) return nil, fmt.Errorf("describing instances: %w", err)
return nil, err
} }
} }
} }
@ -440,8 +436,7 @@ func (p *Provider) lookupTaskDefinitions(ctx context.Context, client *awsClient,
TaskDefinition: task.TaskDefinitionArn, TaskDefinition: task.TaskDefinitionArn,
}) })
if err != nil { if err != nil {
logger.Errorf("Unable to describe task definition: %v", err) return nil, fmt.Errorf("describing task definition: %w", err)
return nil, err
} }
taskDef[arn] = resp.TaskDefinition taskDef[arn] = resp.TaskDefinition