feat: add --insecure flag to allow insecure connections for firmware updates

This commit is contained in:
Alex Lovell-Troy 2025-02-07 09:56:36 -05:00 committed by David Allen
parent 03bf2250a4
commit b31ed136f6
Signed by: towk
GPG key ID: 0430CDBE22619155
2 changed files with 27 additions and 21 deletions

View file

@ -14,6 +14,7 @@ type UpdateParams struct {
FirmwareVersion string
Component string
TransferProtocol string
Insecure bool
}
// UpdateFirmwareRemote() uses 'gofish' to update the firmware of a BMC node.
@ -35,8 +36,8 @@ func UpdateFirmwareRemote(q *UpdateParams) error {
return fmt.Errorf("failed to parse URI: %w", err)
}
// Connect to the Redfish service using gofish (using insecure connection for this)
client, err := gofish.Connect(gofish.ClientConfig{Endpoint: uri.String(), Username: q.Username, Password: q.Password, Insecure: true})
// 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})
if err != nil {
return fmt.Errorf("failed to connect to Redfish service: %w", err)
}
@ -70,8 +71,8 @@ func GetUpdateStatus(q *UpdateParams) error {
return fmt.Errorf("failed to parse URI: %w", err)
}
// Connect to the Redfish service using gofish (using insecure connection for this)
client, err := gofish.Connect(gofish.ClientConfig{Endpoint: uri.String(), Username: q.Username, Password: q.Password, Insecure: true})
// 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})
if err != nil {
return fmt.Errorf("failed to connect to Redfish service: %w", err)
}