Skip to content

Commit

Permalink
distro: flip the installer customization check order
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Vogt <[email protected]>
  • Loading branch information
achilleas-k and mvo5 committed May 16, 2024
1 parent d6a04d5 commit c3c840c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
8 changes: 5 additions & 3 deletions pkg/distro/fedora/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,11 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
return []string{w}, nil
}

if instCust, err := customizations.GetInstaller(); instCust != nil {
instCust, err := customizations.GetInstaller()
if err != nil {
return nil, err
}
if instCust != nil {
// only supported by the Anaconda installer
if slices.Index([]string{"iot-installer"}, t.name) == -1 {
return nil, fmt.Errorf("installer customizations are not supported for %q", t.Name())
Expand All @@ -434,8 +438,6 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
(customizations.GetUsers() != nil || customizations.GetGroups() != nil) {
return nil, fmt.Errorf("iot-installer installer.kickstart.contents are not supported in combination with users or groups")
}
} else if err != nil {
return nil, err
}

return nil, nil
Expand Down
8 changes: 5 additions & 3 deletions pkg/distro/rhel/rhel10/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ func checkOptions(t *rhel.ImageType, bp *blueprint.Blueprint, options distro.Ima
warnings = append(warnings, w)
}

if instCust, err := customizations.GetInstaller(); instCust != nil {
instCust, err := customizations.GetInstaller()
if err != nil {
return warnings, err
}
if instCust != nil {
// only supported by the Anaconda installer
if slices.Index([]string{"image-installer", "edge-installer", "live-installer"}, t.Name()) == -1 {
return warnings, fmt.Errorf("installer customizations are not supported for %q", t.Name())
}
} else if err != nil {
return warnings, err
}

return warnings, nil
Expand Down
8 changes: 5 additions & 3 deletions pkg/distro/rhel/rhel8/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ func checkOptions(t *rhel.ImageType, bp *blueprint.Blueprint, options distro.Ima
warnings = append(warnings, w)
}

if instCust, err := customizations.GetInstaller(); instCust != nil {
instCust, err := customizations.GetInstaller()
if err != nil {
return warnings, err
}
if instCust != nil {
// only supported by the Anaconda installer
if slices.Index([]string{"image-installer", "edge-installer", "live-installer"}, t.Name()) == -1 {
return warnings, fmt.Errorf("installer customizations are not supported for %q", t.Name())
Expand All @@ -187,8 +191,6 @@ func checkOptions(t *rhel.ImageType, bp *blueprint.Blueprint, options distro.Ima
(customizations.GetUsers() != nil || customizations.GetGroups() != nil) {
return warnings, fmt.Errorf("edge-installer installer.kickstart.contents are not supported in combination with users or groups")
}
} else if err != nil {
return warnings, err
}

return warnings, nil
Expand Down
8 changes: 5 additions & 3 deletions pkg/distro/rhel/rhel9/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ func checkOptions(t *rhel.ImageType, bp *blueprint.Blueprint, options distro.Ima
warnings = append(warnings, w)
}

if instCust, err := customizations.GetInstaller(); instCust != nil {
instCust, err := customizations.GetInstaller()
if err != nil {
return warnings, err
}
if instCust != nil {
// only supported by the Anaconda installer
if slices.Index([]string{"image-installer", "edge-installer", "live-installer"}, t.Name()) == -1 {
return warnings, fmt.Errorf("installer customizations are not supported for %q", t.Name())
Expand All @@ -206,8 +210,6 @@ func checkOptions(t *rhel.ImageType, bp *blueprint.Blueprint, options distro.Ima
(customizations.GetUsers() != nil || customizations.GetGroups() != nil) {
return warnings, fmt.Errorf("edge-installer installer.kickstart.contents are not supported in combination with users or groups")
}
} else if err != nil {
return warnings, err
}

return warnings, nil
Expand Down

0 comments on commit c3c840c

Please sign in to comment.