mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Merge pull request #52 from OpenCHAMI/minor-changes
Minor changes and improvements
This commit is contained in:
commit
76b6f37e9d
2 changed files with 12 additions and 3 deletions
|
|
@ -150,7 +150,6 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) error {
|
||||||
if smdClient.URI != "" {
|
if smdClient.URI != "" {
|
||||||
err = smdClient.Add(body, headers)
|
err = smdClient.Add(body, headers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msgf("failed to add Redfish endpoint")
|
|
||||||
|
|
||||||
// try updating instead
|
// try updating instead
|
||||||
if params.ForceUpdate {
|
if params.ForceUpdate {
|
||||||
|
|
@ -159,6 +158,8 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msgf("failed to forcibly update Redfish endpoint")
|
log.Error().Err(err).Msgf("failed to forcibly update Redfish endpoint")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Error().Err(err).Msgf("failed to add Redfish endpoint")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,11 @@ func (c SmdClient) Add(data HTTPBody, headers HTTPHeader) error {
|
||||||
if res != nil {
|
if res != nil {
|
||||||
statusOk := res.StatusCode >= 200 && res.StatusCode < 300
|
statusOk := res.StatusCode >= 200 && res.StatusCode < 300
|
||||||
if !statusOk {
|
if !statusOk {
|
||||||
return fmt.Errorf("returned status code %d when adding endpoint", res.StatusCode)
|
if len(body) > 0 {
|
||||||
|
return fmt.Errorf("%d: %s", res.StatusCode, string(body))
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("returned status code %d when adding endpoint", res.StatusCode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
|
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +61,11 @@ func (c SmdClient) Update(data HTTPBody, headers HTTPHeader) error {
|
||||||
if res != nil {
|
if res != nil {
|
||||||
statusOk := res.StatusCode >= 200 && res.StatusCode < 300
|
statusOk := res.StatusCode >= 200 && res.StatusCode < 300
|
||||||
if !statusOk {
|
if !statusOk {
|
||||||
return fmt.Errorf("failed to update redfish endpoint (returned %s)", res.Status)
|
if len(body) > 0 {
|
||||||
|
return fmt.Errorf("%d: %s", res.StatusCode, string(body))
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("failed to update redfish endpoint (returned %s)", res.Status)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
|
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue