builder/parallels: fix compilation issuse

This commit is contained in:
Mitchell Hashimoto 2015-06-22 12:46:13 -07:00
parent 0c5ea9aa36
commit 1aa1399e85
4 changed files with 7 additions and 18 deletions

View File

@ -1,28 +1,17 @@
package common
import (
"fmt"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template/interpolate"
)
type PrlctlPostConfig struct {
PrlctlPost [][]string `mapstructure:"prlctl_post"`
}
func (c *PrlctlPostConfig) Prepare(t *packer.ConfigTemplate) []error {
func (c *PrlctlPostConfig) Prepare(ctx *interpolate.Context) []error {
if c.PrlctlPost == nil {
c.PrlctlPost = make([][]string, 0)
}
errs := make([]error, 0)
for i, args := range c.PrlctlPost {
for j, arg := range args {
if err := t.Validate(arg); err != nil {
errs = append(errs,
fmt.Errorf("Error processing prlctl_post[%d][%d]: %s", i, j, err))
}
}
}
return errs
return nil
}

View File

@ -79,7 +79,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
errs, b.config.OutputConfig.Prepare(&b.config.ctx, &b.config.PackerConfig)...)
errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs, b.config.PrlctlConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs, b.config.PrlctlPostConfig.Prepare(&b.config.tpl)...)
errs = packer.MultiErrorAppend(errs, b.config.PrlctlPostConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs, b.config.PrlctlVersionConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs, b.config.ShutdownConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs, b.config.SSHConfig.Prepare(&b.config.ctx)...)
@ -270,7 +270,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
},
&parallelscommon.StepPrlctl{
Commands: b.config.PrlctlPost,
Tpl: b.config.tpl,
Ctx: b.config.ctx,
},
}

View File

@ -103,7 +103,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
},
&parallelscommon.StepPrlctl{
Commands: b.config.PrlctlPost,
Tpl: b.config.tpl,
Ctx: b.config.ctx,
},
}

View File

@ -58,7 +58,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
errs = packer.MultiErrorAppend(errs, c.FloppyConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.OutputConfig.Prepare(&c.ctx, &c.PackerConfig)...)
errs = packer.MultiErrorAppend(errs, c.PrlctlConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.PrlctlPostConfig.Prepare(&c.tpl)...)
errs = packer.MultiErrorAppend(errs, c.PrlctlPostConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.PrlctlVersionConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare(&c.ctx)...)