From 249d9d1c73d00b94d5400b871f801a875412f3f2 Mon Sep 17 00:00:00 2001 From: Joel Rebello Date: Mon, 17 Jul 2023 11:16:51 +0200 Subject: [PATCH] Format component model numbers since devices report them differently --- go.mod | 4 ++-- go.sum | 12 ++++++------ internal/model/component.go | 2 +- internal/outofband/action_handlers.go | 8 ++++++++ internal/outofband/bmc.go | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index e3f7115a..c137ae8d 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 0f105c8a..4f726d5b 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/internal/model/component.go b/internal/model/component.go index 61c5b850..fd6318d6 100644 --- a/internal/model/component.go +++ b/internal/model/component.go @@ -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 diff --git a/internal/outofband/action_handlers.go b/internal/outofband/action_handlers.go index 031ec836..bfa1df6f 100644 --- a/internal/outofband/action_handlers.go +++ b/internal/outofband/action_handlers.go @@ -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") } diff --git a/internal/outofband/bmc.go b/internal/outofband/bmc.go index 2e8b0e89..595a93bb 100644 --- a/internal/outofband/bmc.go +++ b/internal/outofband/bmc.go @@ -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")