This commit is contained in:
Matthew Hooker 2016-12-14 01:01:57 -08:00
parent 00e4585ce5
commit 1408c3fde8
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 7 additions and 3 deletions

View File

@ -36,13 +36,17 @@ func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
// ImageVisibility values
// https://wiki.openstack.org/wiki/Glance-v2-community-image-visibility-design
if c.ImageVisibility != "" {
valid := []string{"public", "private", "shared", "community"}
for _, val := range valid {
validVals := []string{"public", "private", "shared", "community"}
valid := false
for _, val := range validVals {
if string(c.ImageVisibility) == val {
valid = true
break
}
}
errs = append(errs, fmt.Errorf("Unknown visibility value %s", c.ImageVisibility))
if !valid {
errs = append(errs, fmt.Errorf("Unknown visibility value %s", c.ImageVisibility))
}
}
if len(errs) > 0 {