builder/amazon/common: wait for AMI to be available [GH-207]

This commit is contained in:
Mitchell Hashimoto 2013-07-26 09:38:16 -07:00
parent 234508376a
commit 83aca618d8
2 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,8 @@ IMPROVEMENTS:
BUG FIXES:
* builder/amazon/all: Gracefully handle when AMI appears to not exist
while AWS state is propogating. [GH-207]
* builder/virtualbox: Trim carriage returns for Windows to properly
detect VM state on Windows. [GH-218]
* core: build names no longer cause invalid config errors. [GH-197]

View File

@ -11,6 +11,11 @@ func WaitForAMI(c *ec2.EC2, imageId string) error {
for {
imageResp, err := c.Images([]string{imageId}, ec2.NewFilter())
if err != nil {
if ec2err, ok := err.(*ec2.Error); ok && ec2err.Code == "InvalidAMIID.NotFound" {
log.Println("AMI not found, probably state issues on AWS side. Trying again.")
continue
}
return err
}