Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers/asrockrack: when checking component, use upper case #360

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions providers/asrockrack/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func (a *ASRockRack) FirmwareInstall(ctx context.Context, component, applyAt str
size = finfo.Size()
}

component = strings.ToUpper(component)
switch component {
case common.SlugBIOS:
err = a.firmwareInstallBIOS(ctx, reader, size)
Expand All @@ -51,6 +52,7 @@ func (a *ASRockRack) FirmwareInstall(ctx context.Context, component, applyAt str

// FirmwareInstallStatus returns the status of the firmware install process, a bool value indicating if the component requires a reset
func (a *ASRockRack) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status string, err error) {
component = strings.ToUpper(component)
switch component {
case common.SlugBIOS, common.SlugBMC:
return a.firmwareUpdateStatus(ctx, component, installVersion)
Expand Down Expand Up @@ -139,6 +141,7 @@ func (a *ASRockRack) firmwareInstallBIOS(ctx context.Context, reader io.Reader,
// firmwareUpdateBIOSStatus returns the BIOS firmware install status
func (a *ASRockRack) firmwareUpdateStatus(ctx context.Context, component string, installVersion string) (status string, err error) {
var endpoint string
component = strings.ToUpper(component)
switch component {
case common.SlugBIOS:
endpoint = "api/asrr/maintenance/BIOS/flash-progress"
Expand Down Expand Up @@ -197,6 +200,7 @@ func (a *ASRockRack) firmwareUpdateStatus(ctx context.Context, component string,
// - 1 indicates the given version parameter does not match the version installed
// - 2 the version parameter returned from the BMC is empty (which means the BMC needs a reset)
func (a *ASRockRack) versionInstalled(ctx context.Context, component, version string) (status int, err error) {
component = strings.ToUpper(component)
if !internal.StringInSlice(component, []string{common.SlugBIOS, common.SlugBMC}) {
return versionStrError, errors.Wrap(bmclibErrs.ErrFirmwareInstall, "component unsupported: "+component)
}
Expand Down