mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Changed the default storage location for scanning cache
This commit is contained in:
parent
e93f49eb82
commit
b6d429f072
3 changed files with 15 additions and 12 deletions
|
|
@ -48,8 +48,8 @@ var collectCmd = &cobra.Command{
|
||||||
threads = mathutil.Clamp(len(probeStates), 1, 255)
|
threads = mathutil.Clamp(len(probeStates), 1, 255)
|
||||||
}
|
}
|
||||||
q := &magellan.QueryParams{
|
q := &magellan.QueryParams{
|
||||||
User: user,
|
User: username,
|
||||||
Pass: pass,
|
Pass: password,
|
||||||
Protocol: protocol,
|
Protocol: protocol,
|
||||||
Drivers: drivers,
|
Drivers: drivers,
|
||||||
Preferred: preferredDriver,
|
Preferred: preferredDriver,
|
||||||
|
|
@ -75,8 +75,8 @@ func init() {
|
||||||
collectCmd.PersistentFlags().StringSliceVar(&drivers, "driver", []string{"redfish"}, "set the driver(s) and fallback drivers to use")
|
collectCmd.PersistentFlags().StringSliceVar(&drivers, "driver", []string{"redfish"}, "set the driver(s) and fallback drivers to use")
|
||||||
collectCmd.PersistentFlags().StringVar(&smd.Host, "host", smd.Host, "set the host to the smd API")
|
collectCmd.PersistentFlags().StringVar(&smd.Host, "host", smd.Host, "set the host to the smd API")
|
||||||
collectCmd.PersistentFlags().IntVarP(&smd.Port, "port", "p", smd.Port, "set the port to the smd API")
|
collectCmd.PersistentFlags().IntVarP(&smd.Port, "port", "p", smd.Port, "set the port to the smd API")
|
||||||
collectCmd.PersistentFlags().StringVar(&user, "user", "", "set the BMC user")
|
collectCmd.PersistentFlags().StringVar(&username, "user", "", "set the BMC user")
|
||||||
collectCmd.PersistentFlags().StringVar(&pass, "pass", "", "set the BMC password")
|
collectCmd.PersistentFlags().StringVar(&password, "pass", "", "set the BMC password")
|
||||||
collectCmd.PersistentFlags().StringVar(&protocol, "protocol", "https", "set the protocol used to query")
|
collectCmd.PersistentFlags().StringVar(&protocol, "protocol", "https", "set the protocol used to query")
|
||||||
collectCmd.PersistentFlags().StringVarP(&outputPath, "output", "o", "/tmp/magellan/data/", "set the path to store collection data")
|
collectCmd.PersistentFlags().StringVarP(&outputPath, "output", "o", "/tmp/magellan/data/", "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().BoolVar(&forceUpdate, "force-update", false, "set flag to force update data sent to SMD ")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"os/user"
|
||||||
|
|
||||||
magellan "github.com/OpenCHAMI/magellan/internal"
|
magellan "github.com/OpenCHAMI/magellan/internal"
|
||||||
"github.com/OpenCHAMI/magellan/internal/api/smd"
|
"github.com/OpenCHAMI/magellan/internal/api/smd"
|
||||||
|
|
@ -19,8 +20,8 @@ var (
|
||||||
hosts []string
|
hosts []string
|
||||||
protocol string
|
protocol string
|
||||||
cacertPath string
|
cacertPath string
|
||||||
user string
|
username string
|
||||||
pass string
|
password string
|
||||||
dbpath string
|
dbpath string
|
||||||
drivers []string
|
drivers []string
|
||||||
preferredDriver string
|
preferredDriver string
|
||||||
|
|
@ -76,13 +77,15 @@ func LoadAccessToken() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
// get the current user
|
||||||
|
currentUser, _ := user.Current()
|
||||||
cobra.OnInitialize(InitializeConfig)
|
cobra.OnInitialize(InitializeConfig)
|
||||||
rootCmd.PersistentFlags().IntVar(&threads, "threads", -1, "set the number of threads")
|
rootCmd.PersistentFlags().IntVar(&threads, "threads", -1, "set the number of threads")
|
||||||
rootCmd.PersistentFlags().IntVar(&timeout, "timeout", 30, "set the timeout")
|
rootCmd.PersistentFlags().IntVar(&timeout, "timeout", 30, "set the timeout")
|
||||||
rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "set the config file path")
|
rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "set the config file path")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "set verbose flag")
|
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "set verbose flag")
|
||||||
rootCmd.PersistentFlags().StringVar(&accessToken, "access-token", "", "set the access token")
|
rootCmd.PersistentFlags().StringVar(&accessToken, "access-token", "", "set the access token")
|
||||||
rootCmd.PersistentFlags().StringVar(&dbpath, "db.path", "/tmp/magellan/magellan.db", "set the probe storage path")
|
rootCmd.PersistentFlags().StringVar(&dbpath, "db.path", fmt.Sprintf("/tmp/%smagellan/magellan.db", currentUser.Name+"/"), "set the probe storage path")
|
||||||
|
|
||||||
// bind viper config flags with cobra
|
// bind viper config flags with cobra
|
||||||
viper.BindPFlag("threads", rootCmd.Flags().Lookup("threads"))
|
viper.BindPFlag("threads", rootCmd.Flags().Lookup("threads"))
|
||||||
|
|
|
||||||
|
|
@ -33,15 +33,15 @@ var updateCmd = &cobra.Command{
|
||||||
Preferred: "redfish",
|
Preferred: "redfish",
|
||||||
Protocol: protocol,
|
Protocol: protocol,
|
||||||
Host: host,
|
Host: host,
|
||||||
User: user,
|
User: username,
|
||||||
Pass: pass,
|
Pass: password,
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
Port: port,
|
Port: port,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if required params are set
|
// check if required params are set
|
||||||
if host == "" || user == "" || pass == "" {
|
if host == "" || username == "" || password == "" {
|
||||||
l.Log.Fatal("requires host, user, and pass to be set")
|
l.Log.Fatal("requires host, user, and pass to be set")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,8 +69,8 @@ var updateCmd = &cobra.Command{
|
||||||
func init() {
|
func init() {
|
||||||
updateCmd.Flags().StringVar(&host, "bmc-host", "", "set the BMC host")
|
updateCmd.Flags().StringVar(&host, "bmc-host", "", "set the BMC host")
|
||||||
updateCmd.Flags().IntVar(&port, "bmc-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(&username, "user", "", "set the BMC user")
|
||||||
updateCmd.Flags().StringVar(&pass, "pass", "", "set the BMC password")
|
updateCmd.Flags().StringVar(&password, "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(&firmwareUrl, "firmware-url", "", "set the path to the firmware")
|
updateCmd.Flags().StringVar(&firmwareUrl, "firmware-url", "", "set the path to the firmware")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue