chore: small changes, fixes, and refactor

This commit is contained in:
David Allen 2025-05-01 23:29:45 -06:00
parent 2491c6bd1c
commit a62f74dbdd
Signed by: towk
GPG key ID: 0430CDBE22619155
11 changed files with 105 additions and 125 deletions

View file

@ -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 {

View file

@ -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
}

View file

@ -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"
)