Fixes #2434 by adding OpenStack Glance metadata support

This commit is contained in:
Travis Truman 2015-07-15 21:31:13 -04:00
parent f27505626f
commit 988cf2fecf
3 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,8 @@ import (
// ImageConfig is for common configuration related to creating Images.
type ImageConfig struct {
ImageName string `mapstructure:"image_name"`
ImageName string `mapstructure:"image_name"`
ImageMetadata map[string]string `mapstructure:"metadata"`
}
func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {

View File

@ -30,7 +30,8 @@ func (s *stepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
// Create the image
ui.Say(fmt.Sprintf("Creating the image: %s", config.ImageName))
imageId, err := servers.CreateImage(client, server.ID, servers.CreateImageOpts{
Name: config.ImageName,
Name: config.ImageName,
Metadata: config.ImageMetadata,
}).ExtractImageID()
if err != nil {
err := fmt.Errorf("Error creating image: %s", err)

View File

@ -96,6 +96,8 @@ can be configured for this builder.
* `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for
Rackconnect to assign the machine an IP address before connecting via SSH.
Defaults to false.
* `metadata` (object of key/value strings) - Glance metadata that will be applied
to the image.
## Basic Example: Rackspace public cloud