diff --git a/cmd/collect.go b/cmd/collect.go index ef3390c..a62cccc 100644 --- a/cmd/collect.go +++ b/cmd/collect.go @@ -95,15 +95,17 @@ var CollectCmd = &cobra.Command{ // if we have CLI flags set, then we want to override default stored creds if username != "" && password != "" { // finally, use the CLI arguments passed instead + log.Info().Msg("...using provided arguments for credentials") store = secrets.NewStaticStore(username, password) } else { // try and get a default *stored* username/password - secret, err := store.GetSecretByID("default") + secret, err := store.GetSecretByID(secrets.DEFAULT_KEY) if err != nil { // no default found, so use CLI arguments - log.Warn().Err(err).Msg("no default credentials found") + log.Warn().Err(err).Msg("failed to get default credentials...") } else { // found default values in local store so use them + log.Info().Msg("...using default store for credentials") var creds crawler.BMCUsernamePassword err = json.Unmarshal([]byte(secret), &creds) if err != nil { diff --git a/cmd/crawl.go b/cmd/crawl.go index 558f372..68f01cc 100644 --- a/cmd/crawl.go +++ b/cmd/crawl.go @@ -43,7 +43,7 @@ var CrawlCmd = &cobra.Command{ // try and load credentials from local store first store, err = secrets.OpenStore(secretsFile) if err != nil { - log.Warn().Err(err).Msg("failed to open local store...falling back to default provided arguments") + log.Warn().Err(err).Msg("failed to open local store...falling back to provided arguments") // try and use the `username` and `password` arguments instead store = secrets.NewStaticStore(username, password) } @@ -51,12 +51,15 @@ var CrawlCmd = &cobra.Command{ // found the store so try to load the creds _, err = store.GetSecretByID(uri) if err != nil { + log.Warn().Err(err).Msgf("failed to get secrets for '%s'...", uri) // if we have CLI flags set, then we want to override default stored creds if username != "" && password != "" { // finally, use the CLI arguments passed instead + log.Info().Msg("...using provided arguments for credentials") store = secrets.NewStaticStore(username, password) } else { // try and get a default *stored* username/password + log.Info().Msg("...using default stored secrets for credentials") secret, err := store.GetSecretByID(secrets.DEFAULT_KEY) if err != nil { // no default found, so use CLI arguments