shared peer conn
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/workflow/graph"
|
||||
@@ -55,11 +56,18 @@ func (wfa *Workflow) CheckBooking(subPath string) (bool, error) {
|
||||
continue
|
||||
}
|
||||
// CHECK BOOKING
|
||||
url := dc.(*datacenter.DatacenterResource).SourceUrl
|
||||
caller := tools.NewHTTPCaller("", "", "", "")
|
||||
peerID := dc.(*datacenter.DatacenterResource).PeerID
|
||||
if peerID == "" {
|
||||
return false, errors.New("no peer id")
|
||||
}
|
||||
p, code, err := (&peer.Peer{}).GetAccessor(nil).LoadOne(peerID)
|
||||
if code != 200 {
|
||||
return false, err
|
||||
}
|
||||
caller := tools.NewHTTPCaller(map[string]map[tools.METHOD]string{})
|
||||
subPath = strings.ReplaceAll(subPath, ":start_date", wfa.getFormat(wfa.Schedule.Start))
|
||||
subPath = strings.ReplaceAll(subPath, ":end_date", wfa.getFormat(&e))
|
||||
resp, err := caller.CallGet(url, subPath)
|
||||
resp, err := caller.CallGet(p.(*peer.Peer).Url, subPath)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user