mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Minor changes
This commit is contained in:
parent
da2abdfa8d
commit
e02558fd00
3 changed files with 10 additions and 9 deletions
|
|
@ -75,6 +75,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) error {
|
|||
}
|
||||
|
||||
// generate custom xnames for bmcs
|
||||
// TODO: add xname customization via CLI
|
||||
node := xnames.Node{
|
||||
Cabinet: 1000,
|
||||
Chassis: 1,
|
||||
|
|
@ -83,7 +84,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) error {
|
|||
}
|
||||
offset += 1
|
||||
|
||||
// TODO: use pkg/crawler to request inventory data via Redfish
|
||||
// crawl BMC node to fetch inventory data via Redfish
|
||||
systems, err := crawler.CrawlBMC(crawler.CrawlerConfig{
|
||||
URI: fmt.Sprintf("%s:%d", sr.Host, sr.Port),
|
||||
Username: params.Username,
|
||||
|
|
@ -107,7 +108,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) error {
|
|||
}
|
||||
|
||||
// create and set headers for request
|
||||
headers := util.HTTPHeader{}
|
||||
headers := client.HTTPHeader{}
|
||||
headers.Authorization(params.AccessToken)
|
||||
headers.ContentType("application/json")
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/OpenCHAMI/magellan/internal/util"
|
||||
"github.com/OpenCHAMI/magellan/pkg/client"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
|
|||
assetsToAdd := []RemoteAsset{}
|
||||
for _, foundAsset := range foundAssets {
|
||||
url := fmt.Sprintf("%s://%s:%d/redfish/v1/", params.Scheme, foundAsset.Host, foundAsset.Port)
|
||||
res, _, err := util.MakeRequest(nil, url, http.MethodGet, nil, nil)
|
||||
res, _, err := client.MakeRequest(nil, url, http.MethodGet, nil, nil)
|
||||
if err != nil || res == nil {
|
||||
if params.Verbose {
|
||||
log.Printf("failed to make request: %v\n", err)
|
||||
|
|
@ -164,7 +164,7 @@ func GenerateHostsWithSubnet(subnet string, subnetMask *net.IPMask, additionalPo
|
|||
|
||||
// generate new IPs from subnet and format to full URL
|
||||
subnetIps := generateIPsWithSubnet(&subnetIp, subnetMask)
|
||||
return util.FormatIPUrls(subnetIps, additionalPorts, defaultScheme, false)
|
||||
return client.FormatIPUrls(subnetIps, additionalPorts, defaultScheme, false)
|
||||
}
|
||||
|
||||
// GetDefaultPorts() returns a list of default ports. The only reason to have
|
||||
|
|
@ -238,7 +238,7 @@ func generateIPsWithSubnet(ip *net.IP, mask *net.IPMask) []string {
|
|||
hosts := []string{}
|
||||
end := int(math.Pow(2, float64((bits-ones)))) - 1
|
||||
for i := 0; i < end; i++ {
|
||||
ip = util.GetNextIP(ip, 1)
|
||||
ip = client.GetNextIP(ip, 1)
|
||||
if ip == nil {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/OpenCHAMI/magellan/internal/util"
|
||||
"github.com/OpenCHAMI/magellan/pkg/client"
|
||||
)
|
||||
|
||||
type UpdateParams struct {
|
||||
|
|
@ -43,7 +43,7 @@ func UpdateFirmwareRemote(q *UpdateParams) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal data: %v", err)
|
||||
}
|
||||
res, body, err := util.MakeRequest(nil, updateUrl, "POST", data, headers)
|
||||
res, body, err := client.MakeRequest(nil, updateUrl, "POST", data, headers)
|
||||
if err != nil {
|
||||
return fmt.Errorf("something went wrong: %v", err)
|
||||
} else if res == nil {
|
||||
|
|
@ -63,7 +63,7 @@ func GetUpdateStatus(q *UpdateParams) error {
|
|||
}
|
||||
uri.User = url.UserPassword(q.Username, q.Password)
|
||||
updateUrl := fmt.Sprintf("%s/redfish/v1/UpdateService", uri.String())
|
||||
res, body, err := util.MakeRequest(nil, updateUrl, "GET", nil, nil)
|
||||
res, body, err := client.MakeRequest(nil, updateUrl, "GET", nil, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("something went wrong: %v", err)
|
||||
} else if res == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue