mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
refactor: split BMC data structures into pkg/bmc package
This commit is contained in:
parent
88bd791718
commit
ad0708d2ad
4 changed files with 78 additions and 51 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/OpenCHAMI/magellan/pkg/bmc"
|
||||
"github.com/stmcginnis/gofish"
|
||||
"github.com/stmcginnis/gofish/redfish"
|
||||
)
|
||||
|
|
@ -34,8 +35,14 @@ func UpdateFirmwareRemote(q *UpdateParams) error {
|
|||
return fmt.Errorf("failed to parse URI: %w", err)
|
||||
}
|
||||
|
||||
// Get BMC credentials from secret store in update parameters
|
||||
bmcCreds, err := bmc.GetBMCCredentials(q.SecretStore, q.URI)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get BMC credentials: %w", err)
|
||||
}
|
||||
|
||||
// Connect to the Redfish service using gofish
|
||||
client, err := gofish.Connect(gofish.ClientConfig{Endpoint: uri.String(), Username: q.Username, Password: q.Password, Insecure: q.Insecure})
|
||||
client, err := gofish.Connect(gofish.ClientConfig{Endpoint: uri.String(), Username: bmcCreds.Username, Password: bmcCreds.Password, Insecure: q.Insecure})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to connect to Redfish service: %w", err)
|
||||
}
|
||||
|
|
@ -70,8 +77,14 @@ func GetUpdateStatus(q *UpdateParams) error {
|
|||
return fmt.Errorf("failed to parse URI: %w", err)
|
||||
}
|
||||
|
||||
// Get BMC credentials from secret store in update parameters
|
||||
bmcCreds, err := bmc.GetBMCCredentials(q.SecretStore, q.URI)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get BMC credentials: %w", err)
|
||||
}
|
||||
|
||||
// Connect to the Redfish service using gofish
|
||||
client, err := gofish.Connect(gofish.ClientConfig{Endpoint: uri.String(), Username: q.Username, Password: q.Password, Insecure: q.Insecure})
|
||||
client, err := gofish.Connect(gofish.ClientConfig{Endpoint: uri.String(), Username: bmcCreds.Username, Password: bmcCreds.Password, Insecure: q.Insecure})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to connect to Redfish service: %w", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue