mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Fixed issue with collect requests and other minor changes
This commit is contained in:
parent
a6c95ef646
commit
f7159c9b66
5 changed files with 49 additions and 55 deletions
|
|
@ -7,7 +7,6 @@ import (
|
|||
magellan "github.com/OpenCHAMI/magellan/internal"
|
||||
"github.com/OpenCHAMI/magellan/internal/cache/sqlite"
|
||||
"github.com/OpenCHAMI/magellan/internal/util"
|
||||
"github.com/OpenCHAMI/magellan/pkg/client"
|
||||
"github.com/cznic/mathutil"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -51,9 +50,10 @@ var collectCmd = &cobra.Command{
|
|||
|
||||
//
|
||||
if concurrency <= 0 {
|
||||
concurrency = mathutil.Clamp(len(scannedResults), 1, 255)
|
||||
concurrency = mathutil.Clamp(len(scannedResults), 1, 10000)
|
||||
}
|
||||
err = magellan.CollectInventory(&scannedResults, &magellan.CollectParams{
|
||||
URI: host,
|
||||
Username: username,
|
||||
Password: password,
|
||||
Timeout: timeout,
|
||||
|
|
@ -72,14 +72,14 @@ var collectCmd = &cobra.Command{
|
|||
|
||||
func init() {
|
||||
currentUser, _ = user.Current()
|
||||
collectCmd.PersistentFlags().StringVar(&client.Host, "host", "", "set the host:port to the SMD API")
|
||||
collectCmd.PersistentFlags().StringVar(&username, "username", "", "set the BMC user")
|
||||
collectCmd.PersistentFlags().StringVar(&password, "password", "", "set the BMC password")
|
||||
collectCmd.PersistentFlags().StringVar(&scheme, "scheme", "https", "set the scheme used to query")
|
||||
collectCmd.PersistentFlags().StringVar(&protocol, "protocol", "tcp", "set the protocol used to query")
|
||||
collectCmd.PersistentFlags().StringVar(&host, "host", "", "Set the URI to the SMD API")
|
||||
collectCmd.PersistentFlags().StringVar(&username, "username", "", "Set the BMC user")
|
||||
collectCmd.PersistentFlags().StringVar(&password, "password", "", "Set the BMC password")
|
||||
collectCmd.PersistentFlags().StringVar(&scheme, "scheme", "https", "Set the scheme used to query")
|
||||
collectCmd.PersistentFlags().StringVar(&protocol, "protocol", "tcp", "Set the protocol used to query")
|
||||
collectCmd.PersistentFlags().StringVarP(&outputPath, "output", "o", fmt.Sprintf("/tmp/%smagellan/inventory/", currentUser.Username+"/"), "set the path to store collection data")
|
||||
collectCmd.PersistentFlags().BoolVar(&forceUpdate, "force-update", false, "set flag to force update data sent to SMD")
|
||||
collectCmd.PersistentFlags().StringVar(&cacertPath, "cacert", "", "path to CA cert. (defaults to system CAs)")
|
||||
collectCmd.PersistentFlags().BoolVar(&forceUpdate, "force-update", false, "Set flag to force update data sent to SMD")
|
||||
collectCmd.PersistentFlags().StringVar(&cacertPath, "cacert", "", "Path to CA cert. (defaults to system CAs)")
|
||||
|
||||
// set flags to only be used together
|
||||
collectCmd.MarkFlagsRequiredTogether("username", "password")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import (
|
|||
"os/user"
|
||||
|
||||
magellan "github.com/OpenCHAMI/magellan/internal"
|
||||
"github.com/OpenCHAMI/magellan/pkg/client"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
|
@ -112,14 +111,14 @@ func SetDefaults() {
|
|||
viper.SetDefault("config", "")
|
||||
viper.SetDefault("verbose", false)
|
||||
viper.SetDefault("debug", false)
|
||||
viper.SetDefault("cache", fmt.Sprintf("/tmp/%s/magellan/magellan.db", currentUser.Username))
|
||||
viper.SetDefault("cache", fmt.Sprintf("/tmp/%s/magellan/assets.db", currentUser.Username))
|
||||
viper.SetDefault("scan.hosts", []string{})
|
||||
viper.SetDefault("scan.ports", []int{})
|
||||
viper.SetDefault("scan.subnets", []string{})
|
||||
viper.SetDefault("scan.subnet-masks", []net.IP{})
|
||||
viper.SetDefault("scan.disable-probing", false)
|
||||
viper.SetDefault("collect.driver", []string{"redfish"})
|
||||
viper.SetDefault("collect.host", client.Host)
|
||||
viper.SetDefault("collect.host", host)
|
||||
viper.SetDefault("collect.user", "")
|
||||
viper.SetDefault("collect.pass", "")
|
||||
viper.SetDefault("collect.protocol", "tcp")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue