post-processor/*: fix interpolation context

This commit is contained in:
Mitchell Hashimoto 2015-06-22 12:24:27 -07:00
parent 4dc4fa81b9
commit 5241d8c6d6
9 changed files with 22 additions and 13 deletions

View File

@ -54,6 +54,7 @@ type PostProcessor struct {
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},

View File

@ -31,7 +31,7 @@ type Config struct {
Archive string
Algorithm string
ctx *interpolate.Context
ctx interpolate.Context
}
type PostProcessor struct {
@ -53,6 +53,7 @@ var (
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},
@ -69,7 +70,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
p.config.OutputPath = "packer_{{.BuildName}}_{{.Provider}}"
}
if err = interpolate.Validate(p.config.OutputPath, p.config.ctx); err != nil {
if err = interpolate.Validate(p.config.OutputPath, &p.config.ctx); err != nil {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("Error parsing target template: %s", err))
}
@ -94,7 +95,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
errs, fmt.Errorf("%s must be set", key))
}
*ptr, err = interpolate.Render(p.config.OutputPath, p.config.ctx)
*ptr, err = interpolate.Render(p.config.OutputPath, &p.config.ctx)
if err != nil {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("Error processing %s: %s", key, err))

View File

@ -28,6 +28,7 @@ type PostProcessor struct {
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},

View File

@ -34,6 +34,7 @@ type PostProcessor struct {
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},

View File

@ -32,6 +32,7 @@ type PostProcessor struct {
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},

View File

@ -32,6 +32,7 @@ type PostProcessor struct {
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},

View File

@ -48,6 +48,7 @@ type PostProcessor struct {
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{
"box_download_url",

View File

@ -172,6 +172,7 @@ func (p *PostProcessor) configureSingle(c *Config, raws ...interface{}) error {
err := config.Decode(c, &config.DecodeOpts{
Metadata: &md,
Interpolate: true,
InterpolateContext: &c.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{
"output",

View File

@ -44,6 +44,7 @@ type PostProcessor struct {
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},