From 9b887e4bdc6ba59fc3d01767a0099cd1de6ad08f Mon Sep 17 00:00:00 2001 From: Devon Bautista Date: Thu, 17 Apr 2025 09:43:03 -0600 Subject: [PATCH] fix: only do it once --- cmd/collect.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/collect.go b/cmd/collect.go index 5c0b0d4..aab2128 100644 --- a/cmd/collect.go +++ b/cmd/collect.go @@ -78,14 +78,18 @@ var CollectCmd = &cobra.Command{ // Temporarily override username/password of each BMC if one of those // flags is passed. The expectation is that if the flag is specified // on the command line, it should be used. + if username != "" { + log.Info().Msg("--username passed, overriding all usernames with value") + } + if password != "" { + log.Info().Msg("--password passed, overriding all passwords with value") + } switch s := store.(type) { case *secrets.StaticStore: if username != "" { - log.Info().Msg("--username passed, overriding all usernames with value") s.Username = username } if password != "" { - log.Info().Msg("--password passed, overriding all passwords with value") s.Password = password } case *secrets.LocalSecretStore: @@ -94,11 +98,9 @@ var CollectCmd = &cobra.Command{ log.Error().Str("id", k).Err(err).Msg("failed to override BMC credentials") } else { if username != "" { - log.Info().Msg("--username passed, overriding all usernames with value") creds.Username = username } if password != "" { - log.Info().Msg("--password passed, overriding all passwords with value") creds.Password = password }