mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Fixed formatting via gofmt
Signed-off-by: David J. Allen <davidallendj@gmail.com>
This commit is contained in:
parent
ac9556a526
commit
b3368e5264
11 changed files with 94 additions and 103 deletions
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
var collectCmd = &cobra.Command{
|
var collectCmd = &cobra.Command{
|
||||||
Use: "collect",
|
Use: "collect",
|
||||||
Short: "Query information about BMC",
|
Short: "Query information about BMC",
|
||||||
|
|
@ -47,7 +46,7 @@ var collectCmd = &cobra.Command{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init(){
|
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().IntVar(&smd.Port, "port", smd.Port, "set the port to the smd API")
|
collectCmd.PersistentFlags().IntVar(&smd.Port, "port", smd.Port, "set the port to the smd API")
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
var listCmd = &cobra.Command{
|
var listCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List information from scan",
|
Short: "List information from scan",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ var (
|
||||||
Port = 27779
|
Port = 27779
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func makeEndpointUrl(endpoint string) string {
|
func makeEndpointUrl(endpoint string) string {
|
||||||
return Host + ":" + fmt.Sprint(Port) + BaseEndpoint + endpoint
|
return Host + ":" + fmt.Sprint(Port) + BaseEndpoint + endpoint
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func MakeRequest(url string, httpMethod string, body []byte, headers map[string]string) (*http.Response, []byte, error) {
|
func MakeRequest(url string, httpMethod string, body []byte, headers map[string]string) (*http.Response, []byte, error) {
|
||||||
// url := getSmdEndpointUrl(endpoint)
|
// url := getSmdEndpointUrl(endpoint)
|
||||||
req, _ := http.NewRequest(httpMethod, url, bytes.NewBuffer(body))
|
req, _ := http.NewRequest(httpMethod, url, bytes.NewBuffer(body))
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ func CollectInfo(probeStates *[]BMCProbeResult, l *Logger, q *QueryParams) error
|
||||||
for i := 0; i < q.Threads; i++ {
|
for i := 0; i < q.Threads; i++ {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
ps, ok := <- chanProbeState
|
ps, ok := <-chanProbeState
|
||||||
if !ok {
|
if !ok {
|
||||||
wg.Done()
|
wg.Done()
|
||||||
return
|
return
|
||||||
|
|
@ -222,7 +222,7 @@ func CollectInfo(probeStates *[]BMCProbeResult, l *Logger, q *QueryParams) error
|
||||||
for _, ps := range *probeStates {
|
for _, ps := range *probeStates {
|
||||||
// skip if found info from host
|
// skip if found info from host
|
||||||
foundHost := slices.Index(found, ps.Host)
|
foundHost := slices.Index(found, ps.Host)
|
||||||
if !ps.State || foundHost >= 0{
|
if !ps.State || foundHost >= 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
chanProbeState <- ps
|
chanProbeState <- ps
|
||||||
|
|
@ -417,7 +417,7 @@ func QueryChassis(q *QueryParams) ([]byte, error) {
|
||||||
url += fmt.Sprintf("%s:%s@", q.User, q.Pass)
|
url += fmt.Sprintf("%s:%s@", q.User, q.Pass)
|
||||||
}
|
}
|
||||||
url += fmt.Sprintf("%s:%d", q.Host, q.Port)
|
url += fmt.Sprintf("%s:%d", q.Host, q.Port)
|
||||||
config := gofish.ClientConfig {
|
config := gofish.ClientConfig{
|
||||||
Endpoint: url,
|
Endpoint: url,
|
||||||
Username: q.User,
|
Username: q.User,
|
||||||
Password: q.Pass,
|
Password: q.Pass,
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,11 @@ import (
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Logger struct {
|
type Logger struct {
|
||||||
Log *logrus.Logger
|
Log *logrus.Logger
|
||||||
Path string
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func NewLogger(l *logrus.Logger, level logrus.Level) *Logger {
|
func NewLogger(l *logrus.Logger, level logrus.Level) *Logger {
|
||||||
l.SetLevel(level)
|
l.SetLevel(level)
|
||||||
return &Logger{
|
return &Logger{
|
||||||
|
|
@ -19,8 +17,6 @@ func NewLogger(l *logrus.Logger, level logrus.Level) *Logger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *Logger) WriteFile(path string) {
|
||||||
func (l *Logger)WriteFile(path string) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func rawConnect(host string, ports []int, timeout int, keepOpenOnly bool) []BMCProbeResult {
|
func rawConnect(host string, ports []int, timeout int, keepOpenOnly bool) []BMCProbeResult {
|
||||||
results := []BMCProbeResult{}
|
results := []BMCProbeResult{}
|
||||||
for _, p := range ports {
|
for _, p := range ports {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue