Fixed issue QueryEthernetInterfaces not returning anything

This commit is contained in:
David J. Allen 2023-10-10 11:53:11 -06:00
parent 4f839a5b61
commit 346d886edb

View file

@ -465,8 +465,23 @@ func QueryEthernetInterfaces(client *bmclib.Client, q *QueryParams) ([]byte, err
return nil, fmt.Errorf("could not connect to bmc: %v", err)
}
interfaces, err := redfish.ListReferencedEthernetInterfaces(c, "/redfish/v1/Systems/Self/EthernetInterfaces/")
systems, err := c.Service.Systems()
if err != nil {
return nil, fmt.Errorf("could not query storage systems (%v:%v): %v", q.Host, q.Port, err)
}
var interfaces []*redfish.EthernetInterface
for _, system := range systems {
fmt.Printf("%s\n", system.ID + "/EthernetInterfaces/")
i, err := redfish.ListReferencedEthernetInterfaces(c, "/redfish/v1/Systems/" + system.ID + "/EthernetInterfaces/")
if err != nil {
continue
}
interfaces = append(interfaces, i...)
}
if len(interfaces) <= 0 {
return nil, fmt.Errorf("could not get ethernet interfaces: %v", err)
}