Currently, if an implementation that opens a stateful session
in its Opener implementation fails when open is called and then
has a method called, for example, PowerStateGet, that needs to
use the session info, we will get a panic.
This code updates the OpenConnectionFromInterfaces to remove any
provider implementations that fails to open successfully.
We do this and then return a new registrar.Drivers from the Open
method in client.go.
This changes the existing client.go Open method signature.
Returning the registrar.Drivers instead of updating in place I
think is important. We don't want to hide the "magic" because
this can be confusing about why/which providers are being removed.
It also allows the end-user to have flexibility in deciding
if/when to use this newly updated registrar.Drivers.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Updates metadata with open/close providers attempted
and successful. Also, cleaned up tests in the bmc package.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Change the successfulProvider to be the bmc.Metadata
struct. This allows us to grow the metadata we can
provide during a method call.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Without breaking clients, this adds the capability
of relaying to the end-user the name of the provider
that successfully executed. This give info back to
end-users to help if they need to use a certain
provider for certain hardware.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Replace the local registry package with github.com/jacobweinstock/registry
makes the registry much simpler to interact with and
removes the magic of init functions and package-level
variables. Makes registering providers more understandable
through explicit registration.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This is the update to ScanAndDiscover for the registry.
It will run an "isCompatible" function for all registered
providers to determine if the BMC is compatible with the
provider and then will update the registry collection
with all compatible providers.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This function will integrate the ScanAndConnect functionality
to discover and register any providers that are compatible with
the BMC. discover.ScanAndConnect as is doesn't implement any of
the new design interfaces but is here to show a path forward
for how to use the very valuable discovery functionality with
the registry. We'll need to add functionality that will append
to the registry for all providers that are compatible with
a BMC.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
Client package purpose is to be the primary
interaction that a bmclib user would use. It interacts
with the registry to initialize registered providers
with auth and then has pass through functions to call
the interface executor functions.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>