mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
refactor: changed var name for clarity and added logging details
This commit is contained in:
parent
6c5e958863
commit
94a339e39e
1 changed files with 6 additions and 6 deletions
|
|
@ -50,7 +50,7 @@ type CollectParams struct {
|
||||||
//
|
//
|
||||||
// Requests can be made to several of the nodes using a goroutine by setting the q.Concurrency
|
// Requests can be made to several of the nodes using a goroutine by setting the q.Concurrency
|
||||||
// property value between 1 and 10000.
|
// property value between 1 and 10000.
|
||||||
func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secrets.SecretStore) ([]map[string]any, error) {
|
func CollectInventory(assets *[]RemoteAsset, params *CollectParams, localStore secrets.SecretStore) ([]map[string]any, error) {
|
||||||
// check for available remote assets found from scan
|
// check for available remote assets found from scan
|
||||||
if assets == nil {
|
if assets == nil {
|
||||||
return nil, fmt.Errorf("no assets found")
|
return nil, fmt.Errorf("no assets found")
|
||||||
|
|
@ -125,7 +125,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secret
|
||||||
managers []crawler.Manager
|
managers []crawler.Manager
|
||||||
config = crawler.CrawlerConfig{
|
config = crawler.CrawlerConfig{
|
||||||
URI: uri,
|
URI: uri,
|
||||||
CredentialStore: store,
|
CredentialStore: localStore,
|
||||||
Insecure: true,
|
Insecure: true,
|
||||||
}
|
}
|
||||||
err error
|
err error
|
||||||
|
|
@ -135,14 +135,14 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secret
|
||||||
// the provided secretID...
|
// the provided secretID...
|
||||||
// if it does not, use the fallback static store instead with
|
// if it does not, use the fallback static store instead with
|
||||||
// the username and password provided as arguments
|
// the username and password provided as arguments
|
||||||
if store != nil {
|
if localStore != nil {
|
||||||
_, err := store.GetSecretByID(uri)
|
_, err := localStore.GetSecretByID(uri)
|
||||||
if err != nil {
|
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 for user '%s'", uri, params.Username)
|
||||||
config.CredentialStore = fallbackStore
|
config.CredentialStore = fallbackStore
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Warn().Msgf("invalid store...falling back to default provided credentials for %s", uri)
|
log.Warn().Msgf("invalid store for %s...falling back to default provided credentials for user '%s'", uri, params.Username)
|
||||||
config.CredentialStore = fallbackStore
|
config.CredentialStore = fallbackStore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue