mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Minor changes and fixes
This commit is contained in:
parent
174e2084fc
commit
b76d5e61ff
3 changed files with 17 additions and 17 deletions
|
|
@ -51,11 +51,11 @@ func AddRedfishEndpoint(data []byte, headers map[string]string) error {
|
|||
// Add redfish endpoint via POST `/hsm/v2/Inventory/RedfishEndpoints` endpoint
|
||||
url := makeEndpointUrl("/Inventory/RedfishEndpoints")
|
||||
res, body, err := util.MakeRequest(url, "POST", data, headers)
|
||||
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
|
||||
if res != nil {
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("could not add redfish endpoint")
|
||||
}
|
||||
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,16 +153,16 @@ func CollectInfo(probeStates *[]ScannedResult, l *log.Logger, q *QueryParams) er
|
|||
node.NodeBMC += 1
|
||||
|
||||
// data to be sent to smd
|
||||
data := make(map[string]any)
|
||||
data["ID"] = fmt.Sprintf("%v", node.String()[:len(node.String())-2])
|
||||
data["Type"] = ""
|
||||
data["Name"] = ""
|
||||
data["FQDN"] = ps.Host
|
||||
data["User"] = q.User
|
||||
data["Password"] = q.Pass
|
||||
data["IPAddr"] = ""
|
||||
data["MACAddr"] = ""
|
||||
data["RediscoverOnUpdate"] = false
|
||||
data := map[string]any{
|
||||
"ID": fmt.Sprintf("%v", node.String()[:len(node.String())-2]),
|
||||
"Type": "",
|
||||
"Name": "",
|
||||
"FQDN": ps.Host,
|
||||
"User": q.User,
|
||||
"Password": q.Pass,
|
||||
"MACRequired": true,
|
||||
"RediscoverOnUpdate": false,
|
||||
}
|
||||
|
||||
// unmarshal json to send in correct format
|
||||
var rm map[string]json.RawMessage
|
||||
|
|
@ -191,14 +191,14 @@ func CollectInfo(probeStates *[]ScannedResult, l *log.Logger, q *QueryParams) er
|
|||
continue
|
||||
}
|
||||
json.Unmarshal(interfaces, &rm)
|
||||
data["Interface"] = rm["Interface"]
|
||||
data["Interfaces"] = rm["Interfaces"]
|
||||
|
||||
// get MAC address of first interface (for now...)
|
||||
if len(rm["Interface"]) > 0 {
|
||||
if len(rm["Interfaces"]) > 0 {
|
||||
var i map[string]interface{}
|
||||
json.Unmarshal(rm["Interface"], &i)
|
||||
json.Unmarshal(rm["Interfaces"], &i)
|
||||
data["MACAddr"] = i["MACAddress"]
|
||||
data["IPAddr"] = i["IPAddress"]
|
||||
data["IPAddress"] = i["IPAddress"]
|
||||
if i["FQDN"] != "" {
|
||||
data["FQDN"] = rm["FQDN"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ func CreateProbeResultsIfNotExists(path string) (*sqlx.DB, error) {
|
|||
return db, nil
|
||||
}
|
||||
|
||||
func InsertProbeResults(path string, states *[]magellan.BMCProbeResult) error {
|
||||
func InsertProbeResults(path string, states *[]magellan.ScannedResult) error {
|
||||
if states == nil {
|
||||
return fmt.Errorf("states == nil")
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ func InsertProbeResults(path string, states *[]magellan.BMCProbeResult) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func DeleteProbeResults(path string, results *[]magellan.BMCProbeResult) error {
|
||||
func DeleteProbeResults(path string, results *[]magellan.ScannedResult) error {
|
||||
if results == nil {
|
||||
return fmt.Errorf("no probe results found")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue