From 1bfb1d9702dc7f7686d5612fff963be3d9d0a1b8 Mon Sep 17 00:00:00 2001 From: Jake Schuurmans Date: Mon, 11 Nov 2024 10:59:36 -0500 Subject: [PATCH] Fix bmc client Fix bad condition error state --- go.mod | 2 +- go.sum | 2 ++ internal/bioscfg/handler.go | 8 +++++--- internal/store/bmc/bmc.go | 8 +------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index fd567f7..69bf4ab 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/metal-toolbox/bioscfg go 1.23.1 require ( - github.com/bmc-toolbox/bmclib/v2 v2.3.4 + github.com/bmc-toolbox/bmclib/v2 v2.3.5-0.20241111155613-31918a066b74 github.com/bombsimon/logrusr/v4 v4.1.0 github.com/coreos/go-oidc/v3 v3.11.0 github.com/equinix-labs/otel-init-go v0.0.9 diff --git a/go.sum b/go.sum index 3f764f9..7a4ebd1 100644 --- a/go.sum +++ b/go.sum @@ -110,6 +110,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmc-toolbox/bmclib/v2 v2.3.4 h1:ihCC9jH8g5Racg4zy+lWpjt7vRt2aWzit3LEL1DiS7k= github.com/bmc-toolbox/bmclib/v2 v2.3.4/go.mod h1:t8If/0fHQTRIK/yKDk2H3SgthDNNj+7z2aeftDFRFrU= +github.com/bmc-toolbox/bmclib/v2 v2.3.5-0.20241111155613-31918a066b74 h1:nrx38H86FUyxumFkPPR06x76v8tlHwVcMwWKPWYaWiw= +github.com/bmc-toolbox/bmclib/v2 v2.3.5-0.20241111155613-31918a066b74/go.mod h1:t8If/0fHQTRIK/yKDk2H3SgthDNNj+7z2aeftDFRFrU= github.com/bmc-toolbox/common v0.0.0-20240926143744-8c478be881d7 h1:Xe6j3oMwe82buwBwEpok9wr+v21Io59pqMTZ5rKRVn8= github.com/bmc-toolbox/common v0.0.0-20240926143744-8c478be881d7/go.mod h1:Cdnkm+edb6C0pVkyCrwh3JTXAe0iUF9diDG/DztPI9I= github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM= diff --git a/internal/bioscfg/handler.go b/internal/bioscfg/handler.go index a1d42ba..d499e2f 100644 --- a/internal/bioscfg/handler.go +++ b/internal/bioscfg/handler.go @@ -82,12 +82,14 @@ func (th *TaskHandler) HandleTask(ctx context.Context, genTask *rctypes.Task[any err = th.bmcClient.Open(ctx) if err != nil { - th.logger.WithError(err).Error("bmc connection failed to connect") - return err + return th.failedWithError(ctx, "bmc connection failed to connect", err) } defer func() { if err := th.bmcClient.Close(ctx); err != nil { - th.logger.WithError(err).Error("bmc connection close error") + err := th.failedWithError(ctx, "bmc connection close error", err) + if err != nil { + th.logger.WithError(err).Error("bmc connection close error, and then failed to set condition status to failed") + } } }() diff --git a/internal/store/bmc/bmc.go b/internal/store/bmc/bmc.go index 292d023..2625800 100644 --- a/internal/store/bmc/bmc.go +++ b/internal/store/bmc/bmc.go @@ -242,16 +242,10 @@ func newBmclibClient(asset *model.Asset, l *logrus.Entry) *bmclib.Client { ) bmcClient.Registry.Drivers = bmcClient.Registry.Supports( - providers.FeatureBmcReset, - providers.FeatureBootDeviceSet, - providers.FeaturePowerSet, - providers.FeaturePowerState, providers.FeatureResetBiosConfiguration, providers.FeatureSetBiosConfiguration, providers.FeatureSetBiosConfigurationFromFile, ) - // NOTE: remove the .Using("redfish") before this ends up in prod - // this is kept here since ipmitool doesn't work well in the docker sandbox env. - return bmcClient.Using("redfish") + return bmcClient }