Commit 988cf2fe authored by Travis Truman's avatar Travis Truman

Fixes #2434 by adding OpenStack Glance metadata support

parent f2750562
...@@ -8,7 +8,8 @@ import ( ...@@ -8,7 +8,8 @@ import (
// ImageConfig is for common configuration related to creating Images. // ImageConfig is for common configuration related to creating Images.
type ImageConfig struct { 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 { func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
......
...@@ -30,7 +30,8 @@ func (s *stepCreateImage) Run(state multistep.StateBag) multistep.StepAction { ...@@ -30,7 +30,8 @@ func (s *stepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
// Create the image // Create the image
ui.Say(fmt.Sprintf("Creating the image: %s", config.ImageName)) ui.Say(fmt.Sprintf("Creating the image: %s", config.ImageName))
imageId, err := servers.CreateImage(client, server.ID, servers.CreateImageOpts{ imageId, err := servers.CreateImage(client, server.ID, servers.CreateImageOpts{
Name: config.ImageName, Name: config.ImageName,
Metadata: config.ImageMetadata,
}).ExtractImageID() }).ExtractImageID()
if err != nil { if err != nil {
err := fmt.Errorf("Error creating image: %s", err) err := fmt.Errorf("Error creating image: %s", err)
......
...@@ -96,6 +96,8 @@ can be configured for this builder. ...@@ -96,6 +96,8 @@ can be configured for this builder.
* `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for * `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for
Rackconnect to assign the machine an IP address before connecting via SSH. Rackconnect to assign the machine an IP address before connecting via SSH.
Defaults to false. Defaults to false.
* `metadata` (object of key/value strings) - Glance metadata that will be applied
to the image.
## Basic Example: Rackspace public cloud ## Basic Example: Rackspace public cloud
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment