This commit is contained in:
Megan Marsh 2019-12-17 16:13:21 -08:00
parent a72242cd70
commit 5bacd37014
2 changed files with 12 additions and 6 deletions

View File

@ -136,11 +136,12 @@ func (c *BuildCommand) GetBuilds(path string) ([]packer.Build, int) {
return c.GetBuildsFromHCL(path)
}
c.Ui.Say(`Legacy JSON Configuration Will Be Used.
The template will be parsed in the legacy configuration style. This style
will continue to work but users are encouraged to move to the new style.
See: https://packer.io/guides/hcl
`)
// TODO: uncomment in v1.5.1 once we've polished HCL a bit more.
// c.Ui.Say(`Legacy JSON Configuration Will Be Used.
// The template will be parsed in the legacy configuration style. This style
// will continue to work but users are encouraged to move to the new style.
// See: https://packer.io/guides/hcl
// `)
// Parse the template
var tpl *template.Template

View File

@ -45,6 +45,7 @@ func (p *Parser) CoreBuildPostProcessors(blocks []*PostProcessorBlock) ([]packer
PType: pp.PType,
})
}
return res, diags
}
@ -74,6 +75,10 @@ func (p *Parser) getBuilds(cfg *PackerConfig) ([]packer.Build, hcl.Diagnostics)
continue
}
postProcessors, moreDiags := p.CoreBuildPostProcessors(build.PostProcessors)
pps := [][]packer.CoreBuildPostProcessor{}
if len(postProcessors) > 0 {
pps = [][]packer.CoreBuildPostProcessor{postProcessors}
}
diags = append(diags, moreDiags...)
if moreDiags.HasErrors() {
continue
@ -83,7 +88,7 @@ func (p *Parser) getBuilds(cfg *PackerConfig) ([]packer.Build, hcl.Diagnostics)
Type: src.Type,
Builder: builder,
Provisioners: provisioners,
PostProcessors: [][]packer.CoreBuildPostProcessor{postProcessors},
PostProcessors: pps,
Variables: cfg.Variables,
}
res = append(res, pcb)