Split up error messages for missing --sbom related flags
Split up the diagnostic for missing SBOM generation settings so that we can more easily tell the difference between "you didn't tell me where to put the output files" and "I don't know how to generate things". [NO NEW TESTS NEEDED] Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
817237adff
commit
1def7d6de4
|
@ -814,8 +814,11 @@ func SBOMScanOptionsFromFlagSet(flags *pflag.FlagSet, findFlagFunc func(name str
|
|||
return nil, fmt.Errorf("invalid value for --sbom-purl-output: %w", err)
|
||||
}
|
||||
|
||||
if options.Image == "" || len(options.Commands) == 0 || (options.SBOMOutput == "" && options.ImageSBOMOutput == "" && options.PURLOutput == "" && options.ImagePURLOutput == "") {
|
||||
return options, fmt.Errorf("sbom configuration missing one or more of (%q, %q, %q, %q, %q or %q)", "--sbom-scanner-imag", "--sbom-scanner-command", "--sbom-output", "--sbom-image-output", "--sbom-purl-output", "--sbom-image-purl-output")
|
||||
if options.Image == "" || len(options.Commands) == 0 {
|
||||
return options, fmt.Errorf("sbom configuration missing one or more of (%q or %q)", "--sbom-scanner-image", "--sbom-scanner-command")
|
||||
}
|
||||
if options.SBOMOutput == "" && options.ImageSBOMOutput == "" && options.PURLOutput == "" && options.ImagePURLOutput == "" {
|
||||
return options, fmt.Errorf("sbom configuration missing one or more of (%q, %q, %q or %q)", "--sbom-output", "--sbom-image-output", "--sbom-purl-output", "--sbom-image-purl-output")
|
||||
}
|
||||
if len(options.Commands) > 1 && options.MergeStrategy == "" {
|
||||
return options, fmt.Errorf("sbom configuration included multiple %q values but no %q value", "--sbom-scanner-command", "--sbom-merge-strategy")
|
||||
|
|
Loading…
Reference in New Issue