Skip to content

Commit

Permalink
Format component model numbers since devices report them differently
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed Jul 17, 2023
1 parent 4c1ccf5 commit 249d9d1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.20

require (
github.com/banzaicloud/logrus-runtime-formatter v0.0.0-20190729070250-5ae5475bae5e
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230711131625-cbbab469ebb2
github.com/bmc-toolbox/common v0.0.0-20230220061748-93ff001f4a1d
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230714085452-c13e347595e3
github.com/bmc-toolbox/common v0.0.0-20230717085817-bf797049f697
github.com/bombsimon/logrusr/v2 v2.0.1
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/emicklei/dot v1.5.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -820,14 +820,14 @@ github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edY
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230622122705-0793b705a33b h1:ILNrrlcvzyXptVdKkCFf3bd6MDFXjj9Tbx9appUCff0=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230622122705-0793b705a33b/go.mod h1:a3Ra0ce/LV3wAj7AHuphlHNTx5Sg67iQqtLGr1zoqio=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230711102641-0869cade6525 h1:giOW+HPPJwR8GigttcrB/uYpvZx344zQQkgXAWjnlAA=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230711102641-0869cade6525/go.mod h1:a3Ra0ce/LV3wAj7AHuphlHNTx5Sg67iQqtLGr1zoqio=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230711131625-cbbab469ebb2 h1:YqOuVWhNpn+sOzLcWVYJehREN2z5xJsQBJxFpEEZK1Q=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230711131625-cbbab469ebb2/go.mod h1:a3Ra0ce/LV3wAj7AHuphlHNTx5Sg67iQqtLGr1zoqio=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230714054223-725e651bac57 h1:UPeJ7QUEpcVdJDcQa+/rGwaN9weJ6Juo9UBBWd1V864=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230714054223-725e651bac57/go.mod h1:a3Ra0ce/LV3wAj7AHuphlHNTx5Sg67iQqtLGr1zoqio=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230714085452-c13e347595e3 h1:+rxq+tlQzFHhK99oLahz+eSqhL1r+Y7OrjIOK8x0j6c=
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230714085452-c13e347595e3/go.mod h1:a3Ra0ce/LV3wAj7AHuphlHNTx5Sg67iQqtLGr1zoqio=
github.com/bmc-toolbox/common v0.0.0-20230220061748-93ff001f4a1d h1:cQ30Wa8mhLzK1TSOG+g3FlneIsXtFgun61mmPwVPmD0=
github.com/bmc-toolbox/common v0.0.0-20230220061748-93ff001f4a1d/go.mod h1:SY//n1PJjZfbFbmAsB6GvEKbc7UXz3d30s3kWxfJQ/c=
github.com/bmc-toolbox/common v0.0.0-20230717085817-bf797049f697 h1:7+PZslRhfmG04JD+/og6ImknU71dmQe60tC+mKl39W4=
github.com/bmc-toolbox/common v0.0.0-20230717085817-bf797049f697/go.mod h1:SY//n1PJjZfbFbmAsB6GvEKbc7UXz3d30s3kWxfJQ/c=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM=
github.com/bombsimon/logrusr/v2 v2.0.1/go.mod h1:ByVAX+vHdLGAfdroiMg6q0zgq2FODY2lc5YJvzmOJio=
Expand Down
2 changes: 1 addition & 1 deletion internal/model/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (cc *ComponentConverter) newComponent(slug, cvendor, cmodel, cserial string

return &Component{
Vendor: common.FormatVendorName(cvendor),
Model: cmodel,
Model: common.FormatProductName(cmodel),
Serial: cserial,
Slug: slug,
}, nil
Expand Down
8 changes: 8 additions & 0 deletions internal/outofband/action_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ func (h *actionHandler) checkCurrentFirmware(a sw.StateSwitch, c sw.TransitionAr

component := components.BySlugVendorModel(action.Firmware.Component, action.Firmware.Vendor, action.Firmware.Models)
if component == nil {
tctx.Logger.WithFields(
logrus.Fields{
"component": action.Firmware.Component,
"vendor": action.Firmware.Vendor,
"models": action.Firmware.Models,
"err": ErrComponentNotFound,
}).Error("none matched given slug, vendor, model attributes")

return errors.Wrap(ErrComponentNotFound, "no match based on given slug, vendor, model attributes")
}

Expand Down
2 changes: 1 addition & 1 deletion internal/outofband/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
loginAttempts = 3

// firmwareInstallTimeout is set on the context when invoking the firmware install method
firmwareInstallTimeout = 15 * time.Minute
firmwareInstallTimeout = 20 * time.Minute

// login errors
errBMCLogin = errors.New("bmc login error")
Expand Down

0 comments on commit 249d9d1

Please sign in to comment.