Rename some update command arguments and reformat output for JSON

This commit is contained in:
David J. Allen 2023-10-18 14:35:57 -06:00
parent 186825eb3e
commit c7061d4768
2 changed files with 6 additions and 6 deletions

View file

@ -10,7 +10,7 @@ import (
var ( var (
host string host string
port int port int
firmwarePath string firmwareUrl string
firmwareVersion string firmwareVersion string
component string component string
transferProtocol string transferProtocol string
@ -23,7 +23,7 @@ var updateCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
l := log.NewLogger(logrus.New(), logrus.DebugLevel) l := log.NewLogger(logrus.New(), logrus.DebugLevel)
q := &magellan.UpdateParams { q := &magellan.UpdateParams {
FirmwarePath: firmwarePath, FirmwarePath: firmwareUrl,
FirmwareVersion: firmwareVersion, FirmwareVersion: firmwareVersion,
Component: component, Component: component,
TransferProtocol: transferProtocol, TransferProtocol: transferProtocol,
@ -67,13 +67,13 @@ var updateCmd = &cobra.Command{
} }
func init() { func init() {
updateCmd.Flags().StringVar(&host, "host", "", "set the BMC host") updateCmd.Flags().StringVar(&host, "bmc-host", "", "set the BMC host")
updateCmd.Flags().IntVar(&port, "port", 443, "set the BMC port") updateCmd.Flags().IntVar(&port, "bmc-port", 443, "set the BMC port")
updateCmd.Flags().StringVar(&user, "user", "", "set the BMC user") updateCmd.Flags().StringVar(&user, "user", "", "set the BMC user")
updateCmd.Flags().StringVar(&pass, "pass", "", "set the BMC password") updateCmd.Flags().StringVar(&pass, "pass", "", "set the BMC password")
updateCmd.Flags().StringVar(&transferProtocol, "transfer-protocol", "HTTP", "set the transfer protocol") updateCmd.Flags().StringVar(&transferProtocol, "transfer-protocol", "HTTP", "set the transfer protocol")
updateCmd.Flags().StringVar(&protocol, "protocol", "https", "set the Redfish protocol") updateCmd.Flags().StringVar(&protocol, "protocol", "https", "set the Redfish protocol")
updateCmd.Flags().StringVar(&firmwarePath, "firmware-path", "", "set the path to the firmware") 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(&firmwareVersion, "firmware-version", "", "set the version of firmware to be installed")
updateCmd.Flags().StringVar(&component, "component", "", "set the component to upgrade") updateCmd.Flags().StringVar(&component, "component", "", "set the component to upgrade")
updateCmd.Flags().BoolVar(&withSecureTLS, "secure-tls", false, "enable secure TLS") updateCmd.Flags().BoolVar(&withSecureTLS, "secure-tls", false, "enable secure TLS")

View file

@ -163,7 +163,7 @@ func GetUpdateStatus(q *UpdateParams) error {
return fmt.Errorf("returned status code %d", res.StatusCode) return fmt.Errorf("returned status code %d", res.StatusCode)
} }
if len(body) > 0 { if len(body) > 0 {
fmt.Printf("%d: %v\n", res.StatusCode, string(body)) fmt.Printf("%v\n", string(body))
} }
return nil return nil
} }