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:
commit
a63ad19b0c
|
@ -59,9 +59,10 @@ 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{
|
||||||
Summary: fmt.Sprintf("Failed loading %s", pp.PType),
|
Severity: hcl.DiagError,
|
||||||
Subject: pp.DefRange.Ptr(),
|
Summary: fmt.Sprintf("Failed loading %s", pp.PType),
|
||||||
Detail: err.Error(),
|
Subject: pp.DefRange.Ptr(),
|
||||||
|
Detail: err.Error(),
|
||||||
})
|
})
|
||||||
return nil, diags
|
return nil, diags
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,9 +146,10 @@ 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{
|
||||||
Summary: fmt.Sprintf("failed loading %s", pb.PType),
|
Severity: hcl.DiagError,
|
||||||
Subject: pb.HCL2Ref.LabelsRanges[0].Ptr(),
|
Summary: fmt.Sprintf("failed loading %s", pb.PType),
|
||||||
Detail: err.Error(),
|
Subject: pb.HCL2Ref.LabelsRanges[0].Ptr(),
|
||||||
|
Detail: err.Error(),
|
||||||
})
|
})
|
||||||
return nil, diags
|
return nil, diags
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,9 @@ 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{
|
||||||
Summary: "Failed to load " + sourceLabel + " type",
|
Severity: hcl.DiagError,
|
||||||
Detail: err.Error(),
|
Summary: "Failed to load " + sourceLabel + " type",
|
||||||
|
Detail: err.Error(),
|
||||||
})
|
})
|
||||||
return builder, diags, nil
|
return builder, diags, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue