Skip to content

Commit

Permalink
fix AMI tag issue
Browse files Browse the repository at this point in the history
  • Loading branch information
d5 committed Sep 2, 2017
1 parent 644c158 commit f7f103f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.7.3
- 1.9

before_install:
- pip install --user awscli
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.1
1.4.2
18 changes: 16 additions & 2 deletions commands/clustercreate/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package clustercreate
import (
"encoding/base64"
"fmt"
"strings"
"time"

"github.com/aws/aws-sdk-go/service/ec2"
Expand All @@ -18,6 +17,18 @@ const (
defaultECSContainerInstanceImageOwnerID = "865092420289"
)

var defaultImageID = map[string]string{
aws.AWSRegionAPNorthEast1: "ami-3217ed54",
aws.AWSRegionAPSouthEast1: "ami-b30b67d0",
aws.AWSRegionAPSouthEast2: "ami-5f38dd3d",
aws.AWSRegionEUCentral1: "ami-3645f059",
aws.AWSRegionEUWest1: "ami-d104c1a8",
aws.AWSRegionUSEast1: "ami-c25a4eb9",
aws.AWSRegionUSEast2: "ami-498dae2c",
aws.AWSRegionUSWest1: "ami-fdcefa9d",
aws.AWSRegionUSWest2: "ami-1d28dd65",
}

var defaultECSContainerInstanceAmazonImageID = map[string]string{
aws.AWSRegionUSEast1: "ami-1924770e",
aws.AWSRegionUSEast2: "ami-bd3e64d8",
Expand Down Expand Up @@ -49,7 +60,7 @@ func (c *Command) getAWSInfo() (string, string, []string, error) {
}

func (c *Command) retrieveDefaultECSContainerInstancesImageID(region string) string {
defaultImages, err := c.awsClient.EC2().FindImage(defaultECSContainerInstanceImageOwnerID, core.AWSTagNameCreatedTimestamp)
/*defaultImages, err := c.awsClient.EC2().FindImage(defaultECSContainerInstanceImageOwnerID, core.AWSTagNameCreatedTimestamp)
if err == nil {
var latestImage *ec2.Image
var latestImageCreationTime string
Expand All @@ -76,6 +87,9 @@ func (c *Command) retrieveDefaultECSContainerInstancesImageID(region string) str
if latestImage != nil {
return conv.S(latestImage.ImageId)
}
}*/
if imageID, ok := defaultImageID[region]; ok {
return imageID
}

// if failed to find coldbrew-cli default image, use Amazon ECS optimized image as fallback
Expand Down

0 comments on commit f7f103f

Please sign in to comment.