Introduce a new configuration parameter instead
... so that one can have a different list compared to instances.
This commit is contained in:
parent
e579b947b1
commit
ac8eedf171
@ -35,6 +35,7 @@ type Config struct {
|
||||
ImageName string `mapstructure:"image_name"`
|
||||
ImageDescription string `mapstructure:"image_description"`
|
||||
ImageFamily string `mapstructure:"image_family"`
|
||||
ImageLabels map[string]string `mapstructure:"image_labels"`
|
||||
InstanceName string `mapstructure:"instance_name"`
|
||||
Labels map[string]string `mapstructure:"labels"`
|
||||
MachineType string `mapstructure:"machine_type"`
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
type Driver interface {
|
||||
// CreateImage creates an image from the given disk in Google Compute
|
||||
// Engine.
|
||||
CreateImage(name, description, family, zone, disk string, labels map[string]string) (<-chan *Image, <-chan error)
|
||||
CreateImage(name, description, family, zone, disk string, image_labels map[string]string) (<-chan *Image, <-chan error)
|
||||
|
||||
// DeleteImage deletes the image with the given name.
|
||||
DeleteImage(name string) <-chan error
|
||||
|
@ -98,7 +98,7 @@ func NewDriverGCE(ui packer.Ui, p string, a *AccountFile) (Driver, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (d *driverGCE) CreateImage(name, description, family, zone, disk string, labels map[string]string) (<-chan *Image, <-chan error) {
|
||||
func (d *driverGCE) CreateImage(name, description, family, zone, disk string, image_labels map[string]string) (<-chan *Image, <-chan error) {
|
||||
gce_image := &compute.Image{
|
||||
Description: description,
|
||||
Name: name,
|
||||
|
@ -81,7 +81,7 @@ type DriverMock struct {
|
||||
WaitForInstanceErrCh <-chan error
|
||||
}
|
||||
|
||||
func (d *DriverMock) CreateImage(name, description, family, zone, disk string, labels map[string]string) (<-chan *Image, <-chan error) {
|
||||
func (d *DriverMock) CreateImage(name, description, family, zone, disk string, image_labels map[string]string) (<-chan *Image, <-chan error) {
|
||||
d.CreateImageName = name
|
||||
d.CreateImageDesc = description
|
||||
d.CreateImageFamily = family
|
||||
|
@ -39,7 +39,7 @@ func (s *StepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
|
||||
|
||||
imageCh, errCh := driver.CreateImage(
|
||||
config.ImageName, config.ImageDescription, config.ImageFamily, config.Zone,
|
||||
config.DiskName, config.Labels)
|
||||
config.DiskName, config.ImageLabels)
|
||||
var err error
|
||||
select {
|
||||
case err = <-errCh:
|
||||
|
@ -198,6 +198,9 @@ builder.
|
||||
instead of a specific image name. The image family always returns its
|
||||
latest image that is not deprecated.
|
||||
|
||||
- `image_labels` (object of key/value strings) - Key/value pair labels to
|
||||
apply to the created image.
|
||||
|
||||
- `image_name` (string) - The unique name of the resulting image. Defaults to
|
||||
`"packer-{{timestamp}}"`.
|
||||
|
||||
@ -205,7 +208,7 @@ builder.
|
||||
this must be unique. Defaults to `"packer-{{uuid}}"`.
|
||||
|
||||
- `labels` (object of key/value strings) - Key/value pair labels to apply to
|
||||
the launched instance and the created image.
|
||||
the launched instance.
|
||||
|
||||
- `machine_type` (string) - The machine type. Defaults to `"n1-standard-1"`.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user