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) return c.GetBuildsFromHCL(path)
} }
c.Ui.Say(`Legacy JSON Configuration Will Be Used. // TODO: uncomment in v1.5.1 once we've polished HCL a bit more.
The template will be parsed in the legacy configuration style. This style // c.Ui.Say(`Legacy JSON Configuration Will Be Used.
will continue to work but users are encouraged to move to the new style. // The template will be parsed in the legacy configuration style. This style
See: https://packer.io/guides/hcl // will continue to work but users are encouraged to move to the new style.
`) // See: https://packer.io/guides/hcl
// `)
// Parse the template // Parse the template
var tpl *template.Template var tpl *template.Template

View File

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