Skip to content

Commit

Permalink
Merge 12728b8 into 9ac493b
Browse files Browse the repository at this point in the history
  • Loading branch information
rgooch committed Apr 5, 2019
2 parents 9ac493b + 12728b8 commit f786dc6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion imagepublishers/amipublisher/libAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ const (
rootDevName = "/dev/sda1"
)

var (
amiNameReplacer = strings.NewReplacer(
"@", "@@",
"~", "@tilde@",
"!", "@bang@",
"#", "@hash@",
"$", "@dollar@",
"%", "@percent@",
"^", "@caret@",
"&", "@ampersand@",
"*", "@asterix@", // the gaul.
"=", "@equal@",
"+", "@plus@",
":", ".",
)
)

func attachVolume(awsService *ec2.EC2, instance *ec2.Instance, volumeId string,
logger log.Logger) error {
usedBlockDevices := make(map[string]struct{})
Expand Down Expand Up @@ -730,7 +747,7 @@ func registerAmi(awsService *ec2.EC2, snapshotId string, s3Manifest string,
Architecture: aws.String("x86_64"),
Description: aws.String(imageName),
EnaSupport: aws.Bool(publishOptions.EnaSupport),
Name: aws.String(strings.Replace(amiName, ":", ".", -1)),
Name: aws.String(amiNameReplacer.Replace(amiName)),
RootDeviceName: aws.String(rootDevName),
SriovNetSupport: aws.String("simple"),
VirtualizationType: aws.String("hvm"),
Expand Down

0 comments on commit f786dc6

Please sign in to comment.