mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Updated 'cmd' package
This commit is contained in:
parent
7fc913eb1f
commit
2c841906b2
6 changed files with 188 additions and 96 deletions
|
|
@ -28,21 +28,6 @@ var updateCmd = &cobra.Command{
|
|||
" magellan update --bmc.host 172.16.0.108 --bmc.port 443 --username bmc_username --password bmc_password --firmware-url http://172.16.0.200:8005/firmware/bios/image.RBU --component BIOS\n" +
|
||||
" magellan update --status --bmc.host 172.16.0.108 --bmc.port 443 --username bmc_username --password bmc_password",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// set up update parameters
|
||||
q := &magellan.UpdateParams{
|
||||
FirmwarePath: firmwareUrl,
|
||||
FirmwareVersion: firmwareVersion,
|
||||
Component: component,
|
||||
TransferProtocol: transferProtocol,
|
||||
QueryParams: magellan.QueryParams{
|
||||
Host: host,
|
||||
Username: username,
|
||||
Password: password,
|
||||
Timeout: timeout,
|
||||
Port: port,
|
||||
},
|
||||
}
|
||||
|
||||
// check if required params are set
|
||||
if host == "" || username == "" || password == "" {
|
||||
log.Error().Msg("requires host, user, and pass to be set")
|
||||
|
|
@ -50,7 +35,19 @@ var updateCmd = &cobra.Command{
|
|||
|
||||
// get status if flag is set and exit
|
||||
if status {
|
||||
err := magellan.GetUpdateStatus(q)
|
||||
err := magellan.GetUpdateStatus(&magellan.UpdateParams{
|
||||
FirmwarePath: firmwareUrl,
|
||||
FirmwareVersion: firmwareVersion,
|
||||
Component: component,
|
||||
TransferProtocol: transferProtocol,
|
||||
CollectParams: magellan.CollectParams{
|
||||
Host: host,
|
||||
Username: username,
|
||||
Password: password,
|
||||
Timeout: timeout,
|
||||
Port: port,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("failed to get update status")
|
||||
}
|
||||
|
|
@ -58,7 +55,19 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
// initiate a remote update
|
||||
err := magellan.UpdateFirmwareRemote(q)
|
||||
err := magellan.UpdateFirmwareRemote(&magellan.UpdateParams{
|
||||
FirmwarePath: firmwareUrl,
|
||||
FirmwareVersion: firmwareVersion,
|
||||
Component: component,
|
||||
TransferProtocol: transferProtocol,
|
||||
CollectParams: magellan.CollectParams{
|
||||
Host: host,
|
||||
Username: username,
|
||||
Password: password,
|
||||
Timeout: timeout,
|
||||
Port: port,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("failed to update firmware")
|
||||
}
|
||||
|
|
@ -71,7 +80,6 @@ func init() {
|
|||
updateCmd.Flags().StringVar(&username, "username", "", "set the BMC user")
|
||||
updateCmd.Flags().StringVar(&password, "password", "", "set the BMC password")
|
||||
updateCmd.Flags().StringVar(&transferProtocol, "transfer-protocol", "HTTP", "set the transfer protocol")
|
||||
updateCmd.Flags().StringVar(&protocol, "protocol", "https", "set the Redfish protocol")
|
||||
updateCmd.Flags().StringVar(&firmwareUrl, "firmware.url", "", "set the path to the firmware")
|
||||
updateCmd.Flags().StringVar(&firmwareVersion, "firmware.version", "", "set the version of firmware to be installed")
|
||||
updateCmd.Flags().StringVar(&component, "component", "", "set the component to upgrade")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue