Merge pull request #3041 from msabramo/GH-3038_openstack_builder_auto_set_image_type_to_image

openstack builder: Set image_type to "image"
This commit is contained in:
Chris Bednarski 2016-01-21 18:39:08 -08:00
commit b7ba9a507d
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,17 @@ func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
errs = append(errs, fmt.Errorf("An image_name must be specified"))
}
// By default, OpenStack seems to create the image with an image_type of
// "snapshot", since it came from snapshotting a VM. A "snapshot" looks
// slightly different in the OpenStack UI and OpenStack won't show "snapshot"
// images as a choice in the list of images to boot from for a new instance.
// See https://github.com/mitchellh/packer/issues/3038
if c.ImageMetadata == nil {
c.ImageMetadata = map[string]string{"image_type": "image"}
} else if c.ImageMetadata["image_type"] == "" {
c.ImageMetadata["image_type"] = "image"
}
if len(errs) > 0 {
return errs
}