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

Don't report error when BMC just rebooted after update #70

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ linters-settings:
revive:
min-confidence: 0
gocyclo:
min-complexity: 10
min-complexity: 11
ofaurax marked this conversation as resolved.
Show resolved Hide resolved
dupl:
threshold: 100
goconst:
Expand Down
7 changes: 7 additions & 0 deletions internal/outofband/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

bmclibv2 "github.com/bmc-toolbox/bmclib/v2"
bmclibv2consts "github.com/bmc-toolbox/bmclib/v2/constants"
bmclibv2errs "github.com/bmc-toolbox/bmclib/v2/errors"

"github.com/bmc-toolbox/common"
"github.com/metal-toolbox/flasher/internal/model"
Expand Down Expand Up @@ -43,6 +44,7 @@ var (

ErrBMCQuery = errors.New("error occurred in bmc query")
ErrMaxBMCQueryAttempts = errors.New("reached maximum BMC query attempts")
ErrTaskNotFound = errors.New("task not found")
ErrFirmwareInstallFailed = errors.New("firmware install failed")
ErrFirmwareInstallStatusUnexpected = errors.New("firmware install status unexpected")
)
Expand Down Expand Up @@ -219,6 +221,11 @@ func (b *bmc) FirmwareInstallStatus(ctx context.Context, installVersion, compone

status, err := b.client.FirmwareInstallStatus(ctx, installVersion, componentSlug, bmcTaskID)
if err != nil {
// If BMC has rebooted, task won't be found, we assume success (failure don't reboot)
if strings.EqualFold(componentSlug, "bmc") && errors.Is(err, bmclibv2errs.ErrTaskNotFound) {
return model.StatusInstallComplete, nil
}

return model.StatusInstallUnknown, errors.Wrap(ErrBMCQuery, err.Error())
}

Expand Down