Skip to content

Commit

Permalink
Fix bmc client
Browse files Browse the repository at this point in the history
Fix bad condition error state
  • Loading branch information
jakeschuurmans committed Nov 11, 2024
1 parent 54716fb commit 2e98439
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
8 changes: 5 additions & 3 deletions internal/bioscfg/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}()

Expand Down
8 changes: 1 addition & 7 deletions internal/store/bmc/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 2e98439

Please sign in to comment.