mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
chore: small changes, fixes, and refactor
This commit is contained in:
parent
2491c6bd1c
commit
a62f74dbdd
11 changed files with 105 additions and 125 deletions
|
|
@ -14,6 +14,9 @@ type BMCCredentials struct {
|
|||
|
||||
func GetBMCCredentialsDefault(store secrets.SecretStore) (BMCCredentials, error) {
|
||||
var creds BMCCredentials
|
||||
if store == nil {
|
||||
return creds, fmt.Errorf("invalid secrets store")
|
||||
}
|
||||
if strCreds, err := store.GetSecretByID(secrets.DEFAULT_KEY); err != nil {
|
||||
return creds, fmt.Errorf("get default BMC credentials from secret store: %w", err)
|
||||
} else {
|
||||
|
|
@ -27,6 +30,9 @@ func GetBMCCredentialsDefault(store secrets.SecretStore) (BMCCredentials, error)
|
|||
|
||||
func GetBMCCredentials(store secrets.SecretStore, id string) (BMCCredentials, error) {
|
||||
var creds BMCCredentials
|
||||
if store == nil {
|
||||
return creds, fmt.Errorf("invalid secrets store")
|
||||
}
|
||||
if strCreds, err := store.GetSecretByID(id); err != nil {
|
||||
return creds, fmt.Errorf("get BMC credentials from secret store: %w", err)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ func loadBMCCreds(config CrawlerConfig) (bmc.BMCCredentials, error) {
|
|||
return bmc.BMCCredentials{}, fmt.Errorf("credential store is invalid")
|
||||
}
|
||||
if creds := util.GetBMCCredentials(config.CredentialStore, config.URI); creds == (bmc.BMCCredentials{}) {
|
||||
return creds, fmt.Errorf("%s: credentials blank for BNC", config.URI)
|
||||
return creds, fmt.Errorf("%s: credentials blank for BMC", config.URI)
|
||||
} else {
|
||||
return creds, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
urlx "github.com/davidallendj/magellan/internal/url"
|
||||
urlx "github.com/davidallendj/magellan/internal/urlx"
|
||||
"github.com/davidallendj/magellan/pkg/client"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue