bmc-toolbox/bmclib

`.FilterForCompatible` doesnt propagate metadata or errors

jacobweinstock opened this issue · 1 comments

If a user or password is incorrect .FilterForCompatible will remove all providers and there is no way to get any error messages or even metadata. This is an example output when i use an incorrect password and call cl.FilterForCompatible(ctx):

/home/tink/repos/bmc/bmclib/client_test.go:26: metadata: {SuccessfulProvider: ProvidersAttempted:[] SuccessfulOpenConns:[] SuccessfulCloseConns:[]}
/home/tink/repos/bmc/bmclib/client_test.go:30: 1 error occurred:
        * no Opener implementations found

This might certainly be an issue to resolve in https://github.com/jacobweinstock/registrar/.

@jacobweinstock is it still worth keeping the FilterForCompatible() method around? Since you've added methods to filter on 'compatible' providers and drivers, and also that Open() will fail if the device is not compatible, this method seems redundant.

In practice using FilterForCompatible() ends up taking up twice the amount of time to connect to a BMC, instead of just using Open(). The compatibility check could instead be made part of Open() - where required, if the device needs to be filtered by model or other attributes.