Prevent panicking when a container has no network interfaces
Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
parent
f01a668d53
commit
b995a11d63
|
@ -315,6 +315,11 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
||||||
|
|
||||||
var mach *machine
|
var mach *machine
|
||||||
if len(task.Attachments) != 0 {
|
if len(task.Attachments) != 0 {
|
||||||
|
if len(container.NetworkInterfaces) == 0 {
|
||||||
|
logger.Errorf("Skip container %s: no network interfaces", aws.StringValue(container.Name))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var ports []portMapping
|
var ports []portMapping
|
||||||
for _, mapping := range containerDefinition.PortMappings {
|
for _, mapping := range containerDefinition.PortMappings {
|
||||||
if mapping != nil {
|
if mapping != nil {
|
||||||
|
@ -378,7 +383,7 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
||||||
|
|
||||||
extraConf, err := p.getConfiguration(instance)
|
extraConf, err := p.getConfiguration(instance)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.FromContext(ctx).Errorf("Skip container %s: %w", getServiceName(instance), err)
|
logger.Errorf("Skip container %s: %w", getServiceName(instance), err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
instance.ExtraConf = extraConf
|
instance.ExtraConf = extraConf
|
||||||
|
|
Loading…
Reference in a new issue