Commit 1aa1399e authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/parallels: fix compilation issuse

parent 0c5ea9aa
package common package common
import ( import (
"fmt" "github.com/mitchellh/packer/template/interpolate"
"github.com/mitchellh/packer/packer"
) )
type PrlctlPostConfig struct { type PrlctlPostConfig struct {
PrlctlPost [][]string `mapstructure:"prlctl_post"` 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 { if c.PrlctlPost == nil {
c.PrlctlPost = make([][]string, 0) c.PrlctlPost = make([][]string, 0)
} }
errs := make([]error, 0) return nil
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
} }
...@@ -79,7 +79,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { ...@@ -79,7 +79,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
errs, b.config.OutputConfig.Prepare(&b.config.ctx, &b.config.PackerConfig)...) 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.RunConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs, b.config.PrlctlConfig.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.PrlctlVersionConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs, b.config.ShutdownConfig.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)...) 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 ...@@ -270,7 +270,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
}, },
&parallelscommon.StepPrlctl{ &parallelscommon.StepPrlctl{
Commands: b.config.PrlctlPost, Commands: b.config.PrlctlPost,
Tpl: b.config.tpl, Ctx: b.config.ctx,
}, },
} }
......
...@@ -103,7 +103,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -103,7 +103,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
}, },
&parallelscommon.StepPrlctl{ &parallelscommon.StepPrlctl{
Commands: b.config.PrlctlPost, Commands: b.config.PrlctlPost,
Tpl: b.config.tpl, Ctx: b.config.ctx,
}, },
} }
......
...@@ -58,7 +58,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { ...@@ -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.FloppyConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.OutputConfig.Prepare(&c.ctx, &c.PackerConfig)...) 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.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.PrlctlVersionConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.RunConfig.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare(&c.ctx)...)
......
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