Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatur authored and traefiker committed May 28, 2018
1 parent db2e630 commit 000ebe0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions provider/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
})
if err != nil {
log.Errorf("Unable to describe tasks for %s", page.TaskArns)
}
for _, t := range resp.Tasks {
tasks[aws.StringValue(t.TaskArn)] = t
} else {
for _, t := range resp.Tasks {
tasks[aws.StringValue(t.TaskArn)] = t
}
}
}
return !lastPage
Expand Down Expand Up @@ -272,6 +273,11 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
}
}

if containerDefinition == nil {
log.Debugf("Unable to find container definition for %s", aws.StringValue(container.Name))
continue
}

var mach *machine
if aws.StringValue(task.LaunchType) == ecs.LaunchTypeFargate {
var hostPort int64
Expand All @@ -297,7 +303,7 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI

instances = append(instances, ecsInstance{
Name: fmt.Sprintf("%s-%s", strings.Replace(aws.StringValue(task.Group), ":", "-", 1), *container.Name),
ID: (key)[len(key)-12:],
ID: key[len(key)-12:],
containerDefinition: containerDefinition,
machine: mach,
TraefikLabels: aws.StringValueMap(containerDefinition.DockerLabels),
Expand Down

0 comments on commit 000ebe0

Please sign in to comment.