Commit 28d12954 authored by Chris Bednarski's avatar Chris Bednarski

Merge branch 'openstack_metadata' of https://github.com/trumant/packer into...

Merge branch 'openstack_metadata' of https://github.com/trumant/packer into trumant-openstack_metadata
parents 5cd6e194 988cf2fe
...@@ -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)
......
...@@ -100,6 +100,9 @@ builder. ...@@ -100,6 +100,9 @@ builder.
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
Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS
......
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