mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
fix: only do it once
This commit is contained in:
parent
f6864bd3f5
commit
9b887e4bdc
1 changed files with 6 additions and 4 deletions
|
|
@ -78,14 +78,18 @@ var CollectCmd = &cobra.Command{
|
||||||
// Temporarily override username/password of each BMC if one of those
|
// Temporarily override username/password of each BMC if one of those
|
||||||
// flags is passed. The expectation is that if the flag is specified
|
// flags is passed. The expectation is that if the flag is specified
|
||||||
// on the command line, it should be used.
|
// 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) {
|
switch s := store.(type) {
|
||||||
case *secrets.StaticStore:
|
case *secrets.StaticStore:
|
||||||
if username != "" {
|
if username != "" {
|
||||||
log.Info().Msg("--username passed, overriding all usernames with value")
|
|
||||||
s.Username = username
|
s.Username = username
|
||||||
}
|
}
|
||||||
if password != "" {
|
if password != "" {
|
||||||
log.Info().Msg("--password passed, overriding all passwords with value")
|
|
||||||
s.Password = password
|
s.Password = password
|
||||||
}
|
}
|
||||||
case *secrets.LocalSecretStore:
|
case *secrets.LocalSecretStore:
|
||||||
|
|
@ -94,11 +98,9 @@ var CollectCmd = &cobra.Command{
|
||||||
log.Error().Str("id", k).Err(err).Msg("failed to override BMC credentials")
|
log.Error().Str("id", k).Err(err).Msg("failed to override BMC credentials")
|
||||||
} else {
|
} else {
|
||||||
if username != "" {
|
if username != "" {
|
||||||
log.Info().Msg("--username passed, overriding all usernames with value")
|
|
||||||
creds.Username = username
|
creds.Username = username
|
||||||
}
|
}
|
||||||
if password != "" {
|
if password != "" {
|
||||||
log.Info().Msg("--password passed, overriding all passwords with value")
|
|
||||||
creds.Password = password
|
creds.Password = password
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue