Skip to content

Commit

Permalink
oem/smc: address linter
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Vandermeulen <[email protected]>
  • Loading branch information
Matt1360 committed Oct 15, 2024
1 parent 0e46b21 commit 1387dcb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions oem/smc/drive.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause
//

package smc

import (
Expand Down Expand Up @@ -61,15 +65,15 @@ func FromDrive(drive *redfish.Drive) (Drive, error) {
// in the Oem sections - certain models and bmc firmwares will mix
// these up, so we check both
smcDrive.indicateTarget = t.Actions.Oem.DriveIndicate.Target
if len(t.Actions.Oem.SmcDriveIndicate.Target) > 0 {
if t.Actions.Oem.SmcDriveIndicate.Target != "" {
smcDrive.indicateTarget = t.Actions.Oem.SmcDriveIndicate.Target
}

return smcDrive, nil
}

// Indicate will set the indicator light activity, true for on, false for off
func (d Drive) Indicate(active bool) error {
func (d *Drive) Indicate(active bool) error {
// Return a common error to let the user try falling back on the normal gofish path
if d.indicateTarget == "" {
return ErrActionNotSupported
Expand Down
6 changes: 5 additions & 1 deletion oem/smc/drive_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause
//

package smc

import (
Expand Down Expand Up @@ -58,7 +62,7 @@ func TestSmcDriveOem(t *testing.T) {
}

if smcDrive.Temperature != 33 {
t.Errorf("unexpected oem drive temerature: %d", smcDrive.Temperature)
t.Errorf("unexpected oem drive temperature: %d", smcDrive.Temperature)
}

if smcDrive.indicateTarget != "/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane/Drives/Disk.Bay.22/Actions/Oem/Drive.Indicate" {
Expand Down

0 comments on commit 1387dcb

Please sign in to comment.