|
|
|
|
@ -6,6 +6,7 @@ import (
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"net/url"
|
|
|
|
|
"os"
|
|
|
|
|
"regexp"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/packer/common"
|
|
|
|
|
@ -94,6 +95,21 @@ func NewConfig(raws ...interface{}) (*Config, error) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Object names can contain only alphanumeric characters, hyphens, underscores, and periods
|
|
|
|
|
reValidObject := regexp.MustCompile("^[a-zA-Z0-9-._/]+$")
|
|
|
|
|
var objectValidation = []struct {
|
|
|
|
|
name string
|
|
|
|
|
value string
|
|
|
|
|
}{
|
|
|
|
|
{"dest_image_list", c.DestImageList},
|
|
|
|
|
{"image_name", c.ImageName},
|
|
|
|
|
}
|
|
|
|
|
for _, ov := range objectValidation {
|
|
|
|
|
if !reValidObject.MatchString(ov.value) {
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("%s can contain only alphanumeric characters, hyphens, underscores, and periods.", ov.name))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if c.Attributes != "" && c.AttributesFile != "" {
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("Only one of user_data or user_data_file can be specified."))
|
|
|
|
|
} else if c.AttributesFile != "" {
|
|
|
|
|
|