Skip to content

Commit

Permalink
FirmwareTaskStatus(): remove unused bool parameter to skip bmc sessio…
Browse files Browse the repository at this point in the history
…n Open
  • Loading branch information
joelrebel committed Dec 5, 2023
1 parent 97fcd3c commit 4d0502f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
8 changes: 4 additions & 4 deletions internal/fixtures/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ type DeviceQueryor interface {

FirmwareUpload(ctx context.Context, component string, reader *os.File) (uploadVerifyTaskID string, err error)

FirmwareTaskStatus(ctx context.Context, kind bconsts.FirmwareInstallStep, component, taskID, installVersion string, tryOpen bool) (state bconsts.TaskState, status string, err error)
FirmwareTaskStatus(ctx context.Context, kind bconsts.FirmwareInstallStep, component, taskID, installVersion string) (state bconsts.TaskState, status string, err error)

FirmwareInstallUploaded(ctx context.Context, component, uploadVerifyTaskID string) (installTaskID string, err error)

Expand Down
1 change: 0 additions & 1 deletion internal/outofband/action_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ func (h *actionHandler) pollFirmwareTaskStatus(a sw.StateSwitch, c sw.Transition
action.Firmware.Component,
action.BMCTaskID,
action.Firmware.Version,
true, // need to be false for AsRockRack E3C256D4ID-NL
)

tctx.Logger.WithFields(
Expand Down
1 change: 0 additions & 1 deletion internal/outofband/action_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ func TestPollFirmwareInstallStatus(t *testing.T) {
gomock.Any(),
gomock.Any(),
gomock.Any(),
gomock.Any(),
).AnyTimes().Return(bconsts.TaskState(tc.state), "some status", tc.errorContains)

if tc.state == "powercycle-host" {
Expand Down
5 changes: 2 additions & 3 deletions internal/outofband/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,17 +409,16 @@ func TestActionStateMachine(t *testing.T) {
func() (*gomock.Controller, *fixtures.MockDeviceQueryor) {
ctrl := gomock.NewController(t)
q := fixtures.NewMockDeviceQueryor(ctrl)

q.EXPECT().Open(gomock.Any()).Return(nil).Times(1)
q.EXPECT().PowerStatus(gomock.Any()).Return("on", nil).Times(1)
q.EXPECT().ResetBMC(gomock.Any()).Return(nil).Times(1)
q.EXPECT().FirmwareInstallUploadAndInitiate(gomock.Any(), gomock.Any(), gomock.Any()).Return("123", nil).Times(1)
q.EXPECT().FirmwareTaskStatus(
gomock.Any(),
gomock.Any(),
gomock.Any(),
gomock.Any(),
gomock.Any(),
gomock.Any(),
).AnyTimes().Return(bconsts.Complete, "some status", nil)

return ctrl, q
Expand Down Expand Up @@ -458,14 +457,14 @@ func TestActionStateMachine(t *testing.T) {

q.EXPECT().Open(gomock.Any()).Return(nil).Times(1)
q.EXPECT().PowerStatus(gomock.Any()).Return("on", nil).Times(1)
q.EXPECT().ResetBMC(gomock.Any()).Return(nil).Times(1)
q.EXPECT().FirmwareInstallUploadAndInitiate(gomock.Any(), gomock.Any(), gomock.Any()).Return("123", nil).Times(1)
q.EXPECT().FirmwareTaskStatus(
gomock.Any(),
gomock.Any(),
gomock.Any(),
gomock.Any(),
gomock.Any(),
gomock.Any(),
).AnyTimes().Return(bconsts.Failed, "some status", nil)

return ctrl, q
Expand Down
8 changes: 3 additions & 5 deletions internal/outofband/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,9 @@ func (b *bmc) FirmwareInstallUploadAndInitiate(ctx context.Context, component st
}

// FirmwareTaskStatus looks up the firmware upload/install state and status values
func (b *bmc) FirmwareTaskStatus(ctx context.Context, kind bconsts.FirmwareInstallStep, component, taskID, installVersion string, tryOpen bool) (state bconsts.TaskState, status string, err error) {
if tryOpen {
if err = b.Open(ctx); err != nil {
return "", "", errors.Wrap(ErrBMCQuery, err.Error())
}
func (b *bmc) FirmwareTaskStatus(ctx context.Context, kind bconsts.FirmwareInstallStep, component, taskID, installVersion string) (state bconsts.TaskState, status string, err error) {
if err = b.Open(ctx); err != nil {
return "", "", errors.Wrap(ErrBMCQuery, err.Error())
}

provider, err := b.provider()
Expand Down

0 comments on commit 4d0502f

Please sign in to comment.