mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
updated all references
This commit is contained in:
parent
c573261f74
commit
1405b42f97
25 changed files with 70 additions and 117 deletions
|
|
@ -1,47 +0,0 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"github.com/OpenCHAMI/magellan/pkg/bmc"
|
||||
"github.com/OpenCHAMI/magellan/pkg/secrets"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func GetBMCCredentials(store secrets.SecretStore, id string) bmc.BMCCredentials {
|
||||
var (
|
||||
creds bmc.BMCCredentials
|
||||
err error
|
||||
)
|
||||
|
||||
if id == "" {
|
||||
log.Error().Msg("failed to get BMC credentials: id was empty")
|
||||
return creds
|
||||
}
|
||||
|
||||
if id == secrets.DEFAULT_KEY {
|
||||
log.Info().Msg("fetching default credentials")
|
||||
if creds, err = bmc.GetBMCCredentialsDefault(store); err != nil {
|
||||
log.Warn().Err(err).Msg("failed to get default credentials")
|
||||
} else {
|
||||
log.Info().Msg("default credentials found, using")
|
||||
}
|
||||
return creds
|
||||
}
|
||||
|
||||
if creds, err = bmc.GetBMCCredentials(store, id); err != nil {
|
||||
// Specific credentials for URI not found, fetch default.
|
||||
log.Warn().Str("id", id).Msg("specific credentials not found, falling back to default")
|
||||
if defaultSecret, err := bmc.GetBMCCredentialsDefault(store); err != nil {
|
||||
// We've exhausted all options, the credentials will be blank unless
|
||||
// overridden by a CLI flag.
|
||||
log.Warn().Str("id", id).Err(err).Msg("no default credentials were set, they will be blank unless overridden by CLI flags")
|
||||
} else {
|
||||
// Default credentials found, use them.
|
||||
log.Info().Str("id", id).Msg("default credentials found, using")
|
||||
creds = defaultSecret
|
||||
}
|
||||
} else {
|
||||
log.Info().Str("id", id).Msg("specific credentials found, using")
|
||||
}
|
||||
|
||||
return creds
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue