diff --git a/internal/fixtures/mock.go b/internal/fixtures/mock.go index c92eaf31..55ccb312 100644 --- a/internal/fixtures/mock.go +++ b/internal/fixtures/mock.go @@ -5,6 +5,7 @@ // // mockgen -source model.go -destination=../fixtures/mock.go -package=fixtures // + // Package fixtures is a generated GoMock package. package fixtures @@ -175,6 +176,18 @@ func (mr *MockDeviceQueryorMockRecorder) PowerStatus(ctx any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PowerStatus", reflect.TypeOf((*MockDeviceQueryor)(nil).PowerStatus), ctx) } +// ReinitializeClient mocks base method. +func (m *MockDeviceQueryor) ReinitializeClient(ctx context.Context) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ReinitializeClient", ctx) +} + +// ReinitializeClient indicates an expected call of ReinitializeClient. +func (mr *MockDeviceQueryorMockRecorder) ReinitializeClient(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReinitializeClient", reflect.TypeOf((*MockDeviceQueryor)(nil).ReinitializeClient), ctx) +} + // ResetBMC mocks base method. func (m *MockDeviceQueryor) ResetBMC(ctx context.Context) error { m.ctrl.T.Helper() diff --git a/internal/model/model.go b/internal/model/model.go index 7e62ec3b..4279f72a 100644 --- a/internal/model/model.go +++ b/internal/model/model.go @@ -117,6 +117,9 @@ type DeviceQueryor interface { ResetBMC(ctx context.Context) error + // Reinitializes the underlying device queryor client to purge old session information. + ReinitializeClient(ctx context.Context) + // Inventory returns the device inventory Inventory(ctx context.Context) (*common.Device, error) diff --git a/internal/outofband/bmc.go b/internal/outofband/bmc.go index 1acdbcc5..ba7ce52f 100644 --- a/internal/outofband/bmc.go +++ b/internal/outofband/bmc.go @@ -100,9 +100,15 @@ func (b *bmc) tracelog() { }).Trace(funcName + ": connection metadata") } -func (b *bmc) rebuildClient(ctx context.Context) { +func (b *bmc) ReinitializeClient(ctx context.Context) { newclient := newBmclibv2Client(ctx, b.asset, b.logger) b.client = newclient + + b.logger.WithFields( + logrus.Fields{ + "provider": b.installProvider, + }, + ).Debug("bmclib client re-initialized") } // Open creates a BMC session