distro: move the checkOptions() call to the top of Manifest()

There's no need to do anything if the options fail to validate, so do
that first.
This commit is contained in:
Achilleas Koutsou 2023-05-11 19:30:45 +02:00 committed by Simon de Vlieger
parent 65be6d65c2
commit d0ba17cfe1
4 changed files with 20 additions and 20 deletions

View file

@ -265,6 +265,11 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
// merge package sets that appear in the image type with the package sets
// of the same name from the distro and arch
staticPackageSets := make(map[string]rpmmd.PackageSet)
@ -289,11 +294,6 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
}
}
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
w := t.workload
if w == nil {
cw := &workload.Custom{

View file

@ -156,6 +156,11 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
// merge package sets that appear in the image type with the package sets
// of the same name from the distro and arch
staticPackageSets := make(map[string]rpmmd.PackageSet)
@ -180,11 +185,6 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
}
}
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
w := t.workload
if w == nil {
cw := &workload.Custom{

View file

@ -190,6 +190,11 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
// merge package sets that appear in the image type with the package sets
// of the same name from the distro and arch
staticPackageSets := make(map[string]rpmmd.PackageSet)
@ -214,11 +219,6 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
}
}
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
w := t.workload
if w == nil {
cw := &workload.Custom{

View file

@ -193,6 +193,11 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
// merge package sets that appear in the image type with the package sets
// of the same name from the distro and arch
staticPackageSets := make(map[string]rpmmd.PackageSet)
@ -217,11 +222,6 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
}
}
warnings, err := t.checkOptions(bp, options)
if err != nil {
return nil, nil, err
}
w := t.workload
if w == nil {
cw := &workload.Custom{