This commit is contained in:
mr 2024-11-06 15:42:06 +01:00
parent 828efb4c98
commit 66413e15bb

View File

@ -3,6 +3,7 @@ package tools
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"strings" "strings"
"cloud.o-forge.io/core/oc-lib/config" "cloud.o-forge.io/core/oc-lib/config"
@ -136,11 +137,13 @@ func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error)
for _, api := range apis { // Check the state of each remote API in the list for _, api := range apis { // Check the state of each remote API in the list
var resp APIStatusResponse var resp APIStatusResponse
b, err := caller.CallGet(api.API()+":8080", "/oc/version/status") // Call the status endpoint of the remote API (standard OC status endpoint) b, err := caller.CallGet(api.API()+":8080", "/oc/version/status") // Call the status endpoint of the remote API (standard OC status endpoint)
fmt.Println(err)
if err != nil { if err != nil {
state = REDUCED_SERVICE // If a remote API is not reachable, return reduced service state = REDUCED_SERVICE // If a remote API is not reachable, return reduced service
continue continue
} }
json.Unmarshal(b, &resp) json.Unmarshal(b, &resp)
fmt.Println(string(b))
if resp.Data == nil { // if resp.Data == nil { //
state = REDUCED_SERVICE // If the response is empty, return reduced service state = REDUCED_SERVICE // If the response is empty, return reduced service
continue continue