mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
refactor: minor changes to store in collect
This commit is contained in:
parent
a8f0c12505
commit
ceeaa5d891
1 changed files with 8 additions and 4 deletions
|
|
@ -70,7 +70,6 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secret
|
||||||
outputPath = path.Clean(params.OutputPath)
|
outputPath = path.Clean(params.OutputPath)
|
||||||
smdClient = &client.SmdClient{Client: &http.Client{}}
|
smdClient = &client.SmdClient{Client: &http.Client{}}
|
||||||
initialStore secrets.SecretStore = store
|
initialStore secrets.SecretStore = store
|
||||||
err error
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// set the client's params from CLI
|
// set the client's params from CLI
|
||||||
|
|
@ -127,11 +126,16 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secret
|
||||||
// the provided secretID...
|
// the provided secretID...
|
||||||
// if it does not, create a static store and use the username
|
// if it does not, create a static store and use the username
|
||||||
// and password provided instead
|
// and password provided instead
|
||||||
_, err = store.GetSecretByID(uri)
|
if store != nil {
|
||||||
if store == nil || err != nil {
|
_, err := store.GetSecretByID(uri)
|
||||||
|
if err != nil {
|
||||||
log.Warn().Err(err).Msgf("could not retrieve secrets for %s...falling back to default provided credentials", uri)
|
log.Warn().Err(err).Msgf("could not retrieve secrets for %s...falling back to default provided credentials", uri)
|
||||||
store = secrets.NewStaticStore(params.Username, params.Password)
|
store = secrets.NewStaticStore(params.Username, params.Password)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Warn().Msgf("invalid store...falling back to default provided credentials for %s", uri)
|
||||||
|
store = secrets.NewStaticStore(params.Username, params.Password)
|
||||||
|
}
|
||||||
|
|
||||||
// crawl BMC node to fetch inventory data via Redfish
|
// crawl BMC node to fetch inventory data via Redfish
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue