Commit c9de4c96 authored by James Massara's avatar James Massara

Make sure ami_regions are valid

parent 228d0d59
......@@ -2,6 +2,7 @@ package common
import (
"fmt"
"github.com/mitchellh/goamz/aws"
"github.com/mitchellh/packer/packer"
)
......@@ -61,6 +62,14 @@ func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
errs = append(errs, fmt.Errorf("ami_name must be specified"))
}
if len(c.AMIRegions) > 0 {
for _, region := range c.AMIRegions {
if _, ok := aws.Regions[region]; !ok {
errs = append(errs, fmt.Errorf("Unknown region: %s", region))
}
}
}
if len(errs) > 0 {
return errs
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment