Skip to content

Commit

Permalink
DeviceQueryor interface: define and implement the ReinitializeClient(…
Browse files Browse the repository at this point in the history
…) method

This is required to have the device queryor client be recreated
for cases where a device has been reset or upgraded and we'd like to
start the client from a clean slate - with no previous session
information.
  • Loading branch information
joelrebel committed Feb 29, 2024
1 parent 9b6269b commit ab3cf47
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
13 changes: 13 additions & 0 deletions internal/fixtures/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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

0 comments on commit ab3cf47

Please sign in to comment.