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
})
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