Merge branch 'openstack_metadata' of https://github.com/trumant/packer into trumant-openstack_metadata
This commit is contained in:
commit
28d1295460
|
@ -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 {
|
||||||
// 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.
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue