simplify call to peer
This commit is contained in:
parent
1986143dd0
commit
fd730741a4
@ -3,6 +3,7 @@ package tools
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||||
)
|
)
|
||||||
@ -66,14 +67,17 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
|
|||||||
caller := NewHTTPCaller(map[string]map[METHOD]string{})
|
caller := NewHTTPCaller(map[string]map[METHOD]string{})
|
||||||
var resp APIStatusResponse
|
var resp APIStatusResponse
|
||||||
b, err := caller.CallPost(url, "/status", []string{})
|
b, err := caller.CallPost(url, "/status", []string{})
|
||||||
|
fmt.Println("CheckRemotePeer", b, err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return DEAD, map[string]int{}
|
return DEAD, map[string]int{}
|
||||||
}
|
}
|
||||||
json.Unmarshal(b, &resp)
|
json.Unmarshal(b, &resp)
|
||||||
|
fmt.Println("CheckRemotePeer2", b, err)
|
||||||
if resp.Data == nil {
|
if resp.Data == nil {
|
||||||
return DEAD, map[string]int{}
|
return DEAD, map[string]int{}
|
||||||
}
|
}
|
||||||
new := map[string]int{}
|
new := map[string]int{}
|
||||||
|
fmt.Println("CheckRemotePeer", resp.Data.Services)
|
||||||
for k, v := range resp.Data.Services {
|
for k, v := range resp.Data.Services {
|
||||||
new[k] = ToState(v).EnumIndex()
|
new[k] = ToState(v).EnumIndex()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user