Fixed issue with required param

This commit is contained in:
David Allen 2024-07-22 14:20:06 -06:00
parent 1ab5c8a7df
commit c537e496da
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC

View file

@ -23,7 +23,12 @@ var (
// on a subnet. // on a subnet.
var collectCmd = &cobra.Command{ var collectCmd = &cobra.Command{
Use: "collect", Use: "collect",
Short: "Query information about BMC", Short: "Collect system information by interrogating BMC node",
Long: "Send request(s) to a collection of hosts running Redfish services found stored from the 'scan' in cache.\n" +
"See the 'scan' command on how to perform a scan.\n\n" +
"Examples:\n" +
" magellan collect --cache ./assets.db --output ./logs --timeout 30 --cacert cecert.pem\n" +
" magellan collect --host smd.example.com --port 27779 --username username --password password",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
// make application logger // make application logger
l := log.NewLogger(logrus.New(), logrus.DebugLevel) l := log.NewLogger(logrus.New(), logrus.DebugLevel)
@ -52,8 +57,8 @@ var collectCmd = &cobra.Command{
concurrency = mathutil.Clamp(len(probeStates), 1, 255) concurrency = mathutil.Clamp(len(probeStates), 1, 255)
} }
q := &magellan.QueryParams{ q := &magellan.QueryParams{
User: username, Username: username,
Pass: password, Password: password,
Protocol: protocol, Protocol: protocol,
Timeout: timeout, Timeout: timeout,
Concurrency: concurrency, Concurrency: concurrency,
@ -88,7 +93,7 @@ func init() {
collectCmd.PersistentFlags().StringVar(&cacertPath, "cacert", "", "path to CA cert. (defaults to system CAs)") collectCmd.PersistentFlags().StringVar(&cacertPath, "cacert", "", "path to CA cert. (defaults to system CAs)")
// set flags to only be used together // set flags to only be used together
collectCmd.MarkFlagsRequiredTogether("user", "pass") collectCmd.MarkFlagsRequiredTogether("username", "password")
viper.BindPFlag("collect.driver", collectCmd.Flags().Lookup("driver")) viper.BindPFlag("collect.driver", collectCmd.Flags().Lookup("driver"))
viper.BindPFlag("collect.host", collectCmd.Flags().Lookup("host")) viper.BindPFlag("collect.host", collectCmd.Flags().Lookup("host"))