Merge pull request #10577 from hashicorp/fix_build_run_diags

plugin loading failure should be considered an error so build will no…
This commit is contained in:
Megan Marsh 2021-02-05 13:31:40 -08:00 committed by GitHub
commit a63ad19b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View File

@ -59,6 +59,7 @@ func (cfg *PackerConfig) startPostProcessor(source SourceUseBlock, pp *PostProce
postProcessor, err := cfg.parser.PluginConfig.PostProcessors.Start(pp.PType) postProcessor, err := cfg.parser.PluginConfig.PostProcessors.Start(pp.PType)
if err != nil { if err != nil {
diags = append(diags, &hcl.Diagnostic{ diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Failed loading %s", pp.PType), Summary: fmt.Sprintf("Failed loading %s", pp.PType),
Subject: pp.DefRange.Ptr(), Subject: pp.DefRange.Ptr(),
Detail: err.Error(), Detail: err.Error(),

View File

@ -146,6 +146,7 @@ func (cfg *PackerConfig) startProvisioner(source SourceUseBlock, pb *Provisioner
provisioner, err := cfg.parser.PluginConfig.Provisioners.Start(pb.PType) provisioner, err := cfg.parser.PluginConfig.Provisioners.Start(pb.PType)
if err != nil { if err != nil {
diags = append(diags, &hcl.Diagnostic{ diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("failed loading %s", pb.PType), Summary: fmt.Sprintf("failed loading %s", pb.PType),
Subject: pb.HCL2Ref.LabelsRanges[0].Ptr(), Subject: pb.HCL2Ref.LabelsRanges[0].Ptr(),
Detail: err.Error(), Detail: err.Error(),

View File

@ -101,6 +101,7 @@ func (cfg *PackerConfig) startBuilder(source SourceUseBlock, ectx *hcl.EvalConte
builder, err := cfg.parser.PluginConfig.Builders.Start(source.Type) builder, err := cfg.parser.PluginConfig.Builders.Start(source.Type)
if err != nil { if err != nil {
diags = append(diags, &hcl.Diagnostic{ diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Failed to load " + sourceLabel + " type", Summary: "Failed to load " + sourceLabel + " type",
Detail: err.Error(), Detail: err.Error(),
}) })