post-processor/*: fix interpolation context
This commit is contained in:
parent
4dc4fa81b9
commit
5241d8c6d6
|
@ -53,7 +53,8 @@ type PostProcessor struct {
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{},
|
Exclude: []string{},
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,7 @@ type Config struct {
|
||||||
Archive string
|
Archive string
|
||||||
Algorithm string
|
Algorithm string
|
||||||
|
|
||||||
ctx *interpolate.Context
|
ctx interpolate.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
type PostProcessor struct {
|
type PostProcessor struct {
|
||||||
|
@ -52,7 +52,8 @@ var (
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{},
|
Exclude: []string{},
|
||||||
},
|
},
|
||||||
|
@ -69,7 +70,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
p.config.OutputPath = "packer_{{.BuildName}}_{{.Provider}}"
|
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 = packer.MultiErrorAppend(
|
||||||
errs, fmt.Errorf("Error parsing target template: %s", err))
|
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))
|
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 {
|
if err != nil {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
errs, fmt.Errorf("Error processing %s: %s", key, err))
|
errs, fmt.Errorf("Error processing %s: %s", key, err))
|
||||||
|
|
|
@ -27,7 +27,8 @@ type PostProcessor struct {
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{},
|
Exclude: []string{},
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,7 +33,8 @@ type PostProcessor struct {
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{},
|
Exclude: []string{},
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,8 @@ type PostProcessor struct {
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{},
|
Exclude: []string{},
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,8 @@ type PostProcessor struct {
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{},
|
Exclude: []string{},
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,7 +47,8 @@ type PostProcessor struct {
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{
|
Exclude: []string{
|
||||||
"box_download_url",
|
"box_download_url",
|
||||||
|
|
|
@ -170,8 +170,9 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
func (p *PostProcessor) configureSingle(c *Config, raws ...interface{}) error {
|
func (p *PostProcessor) configureSingle(c *Config, raws ...interface{}) error {
|
||||||
var md mapstructure.Metadata
|
var md mapstructure.Metadata
|
||||||
err := config.Decode(c, &config.DecodeOpts{
|
err := config.Decode(c, &config.DecodeOpts{
|
||||||
Metadata: &md,
|
Metadata: &md,
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &c.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{
|
Exclude: []string{
|
||||||
"output",
|
"output",
|
||||||
|
|
|
@ -43,7 +43,8 @@ type PostProcessor struct {
|
||||||
|
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
Interpolate: true,
|
Interpolate: true,
|
||||||
|
InterpolateContext: &p.config.ctx,
|
||||||
InterpolateFilter: &interpolate.RenderFilter{
|
InterpolateFilter: &interpolate.RenderFilter{
|
||||||
Exclude: []string{},
|
Exclude: []string{},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue