2013-08-27 00:57:23 -04:00
|
|
|
package openstack
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-05-27 16:02:57 -04:00
|
|
|
|
|
|
|
"github.com/mitchellh/packer/template/interpolate"
|
2013-08-27 00:57:23 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// ImageConfig is for common configuration related to creating Images.
|
|
|
|
type ImageConfig struct {
|
2015-07-15 21:31:13 -04:00
|
|
|
ImageName string `mapstructure:"image_name"`
|
|
|
|
ImageMetadata map[string]string `mapstructure:"metadata"`
|
2013-08-27 00:57:23 -04:00
|
|
|
}
|
|
|
|
|
2015-05-27 16:02:57 -04:00
|
|
|
func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
|
2013-08-27 00:57:23 -04:00
|
|
|
errs := make([]error, 0)
|
|
|
|
if c.ImageName == "" {
|
|
|
|
errs = append(errs, fmt.Errorf("An image_name must be specified"))
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(errs) > 0 {
|
|
|
|
return errs
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|