forwarded-auth
This commit is contained in:
@@ -33,7 +33,7 @@ func (o *WorkflowExecutionController) SearchPerDate() {
|
||||
* The search function returns a list of data that matches the filter
|
||||
* The data is then returned as a json object
|
||||
*/
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
// user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
// store and return Id or post with UUID
|
||||
start_date, _ := time.Parse("2006-01-02", o.Ctx.Input.Param(":start_date"))
|
||||
end_date, _ := time.Parse("2006-01-02", o.Ctx.Input.Param(":end_date"))
|
||||
@@ -45,7 +45,9 @@ func (o *WorkflowExecutionController) SearchPerDate() {
|
||||
},
|
||||
}
|
||||
isDraft := o.Ctx.Input.Query("is_draft")
|
||||
o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).Search(&f, "", isDraft == "true")
|
||||
// o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).Search(&f, "", isDraft == "true")
|
||||
o.Data["json"] = oclib.NewRequestAdmin(collection, nil).Search(&f, "", isDraft == "true")
|
||||
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -55,9 +57,10 @@ func (o *WorkflowExecutionController) SearchPerDate() {
|
||||
// @Success 200 {workflow} models.workflow
|
||||
// @router / [get]
|
||||
func (o *WorkflowExecutionController) GetAll() {
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
// user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
isDraft := o.Ctx.Input.Query("is_draft")
|
||||
o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).LoadAll(isDraft == "true")
|
||||
// o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).LoadAll(isDraft == "true")
|
||||
o.Data["json"] = oclib.NewRequestAdmin(collection, nil).LoadAll(isDraft == "true")
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -67,9 +70,10 @@ func (o *WorkflowExecutionController) GetAll() {
|
||||
// @Success 200 {workflow} models.workflow
|
||||
// @router /:id [get]
|
||||
func (o *WorkflowExecutionController) Get() {
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
//user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
id := o.Ctx.Input.Param(":id")
|
||||
o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).LoadOne(id)
|
||||
// o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).LoadOne(id)
|
||||
o.Data["json"] = oclib.NewRequestAdmin(collection, nil).LoadOne(id)
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -80,9 +84,11 @@ func (o *WorkflowExecutionController) Get() {
|
||||
// @Success 200 {compute} models.compute
|
||||
// @router /search/:search [get]
|
||||
func (o *WorkflowExecutionController) Search() {
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
// user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
isDraft := o.Ctx.Input.Query("is_draft")
|
||||
search := o.Ctx.Input.Param(":search")
|
||||
o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).Search(nil, search, isDraft == "true")
|
||||
// o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).Search(nil, search, isDraft == "true")
|
||||
o.Data["json"] = oclib.NewRequestAdmin(collection, nil).Search(nil, search, isDraft == "true")
|
||||
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -52,14 +52,16 @@ func (o *WorkflowSchedulerController) Schedule() {
|
||||
})
|
||||
|
||||
logger.Info().Msg("Booking for " + wfId)
|
||||
req := oclib.NewRequest(collection, user, peerID, groups, caller)
|
||||
req := oclib.NewRequestAdmin(collection, caller)
|
||||
// req := oclib.NewRequest(collection, user, peerID, groups, caller)
|
||||
resp.UUID = uuid.New().String()
|
||||
|
||||
fmt.Println(user, peerID, groups)
|
||||
sch, _, execs, err := resp.Schedules(wfId, &tools.APIRequest{
|
||||
Username: user,
|
||||
PeerID: peerID,
|
||||
Groups: groups,
|
||||
Caller: caller,
|
||||
Admin: true,
|
||||
})
|
||||
if err != nil {
|
||||
if sch != nil {
|
||||
@@ -113,7 +115,7 @@ func (o *WorkflowSchedulerController) Schedule() {
|
||||
// @Success 200 {workspace} models.workspace
|
||||
// @router /:id [delete]
|
||||
func (o *WorkflowSchedulerController) UnSchedule() {
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
// user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
id := o.Ctx.Input.Param(":id")
|
||||
// TODO UNSCHEDULER
|
||||
filter := &dbs.Filters{
|
||||
@@ -121,7 +123,9 @@ func (o *WorkflowSchedulerController) UnSchedule() {
|
||||
"workflow_id": {{Operator: dbs.EQUAL.String(), Value: id}},
|
||||
},
|
||||
}
|
||||
o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).Search(filter, "", true)
|
||||
o.Data["json"] = oclib.NewRequestAdmin(collection, nil).Search(filter, "", true)
|
||||
|
||||
// o.Data["json"] = oclib.NewRequest(collection, user, peerID, groups, nil).Search(filter, "", true)
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -133,19 +137,22 @@ func (o *WorkflowSchedulerController) UnSchedule() {
|
||||
func (o *WorkflowSchedulerController) SearchScheduledDraftOrder() {
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
id := o.Ctx.Input.Param(":id")
|
||||
fmt.Println(user, peerID, groups)
|
||||
filter := &dbs.Filters{
|
||||
And: map[string][]dbs.Filter{
|
||||
"workflow_id": {{Operator: dbs.EQUAL.String(), Value: id}},
|
||||
"order_by": {{Operator: dbs.EQUAL.String(), Value: peerID}},
|
||||
},
|
||||
}
|
||||
o.Data["json"] = oclib.NewRequest(orderCollection, user, peerID, groups, nil).Search(filter, "", true)
|
||||
o.Data["json"] = oclib.NewRequestAdmin(orderCollection, nil).Search(filter, "", true)
|
||||
|
||||
//o.Data["json"] = oclib.NewRequest(orderCollection, user, peerID, groups, nil).Search(filter, "", true)
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
func createStorageServiceAccount(execId string, peerID string, wfId string, wfs *infrastructure.WorkflowSchedule, caller *tools.HTTPCaller, user string, groups []string) error {
|
||||
// Retrieve the Workflow in the WorkflowSchedule
|
||||
wf := loadWorkflow(wfId, peerID)
|
||||
wf := loadWorkflow(wfId)
|
||||
// storageItems := wf.GetGraphItems(wf.Graph.IsStorage)
|
||||
itemMap := wf.GetItemsByResources()
|
||||
// mapStorageRessources, err := getItemByRessourceId(wf, storageItems)
|
||||
@@ -185,7 +192,7 @@ func createStorageServiceAccount(execId string, peerID string, wfId string, wfs
|
||||
return err
|
||||
}
|
||||
// post on computing datacenter /minio/createSAsecret
|
||||
err = postS3Secret(peerID, *s, caller, execId, wfId, *c, access, secret) // create the secret holding the retrieved access on c's peer
|
||||
err = postS3Secret(*s, caller, execId, wfId, *c, access, secret) // create the secret holding the retrieved access on c's peer
|
||||
if err != nil {
|
||||
// Add a logger.Info() here
|
||||
return err
|
||||
@@ -204,10 +211,10 @@ func createStorageServiceAccount(execId string, peerID string, wfId string, wfs
|
||||
func postCreateServiceAccount(peerID string, s *resources.StorageResource, caller *tools.HTTPCaller, execId string, wfId string) error {
|
||||
l := oclib.GetLogger()
|
||||
fmt.Println("Creating a service account on " + peerID + " for " + s.Name)
|
||||
res := oclib.NewRequest(oclib.LibDataEnum(oclib.PEER), "", peerID, []string{}, nil).LoadOne(s.CreatorID)
|
||||
res := oclib.NewRequestAdmin(oclib.LibDataEnum(oclib.PEER), nil).LoadOne(s.CreatorID)
|
||||
if res.Code != 200 {
|
||||
l.Error().Msg("Error while loading a peer for creation of the serviceAccount")
|
||||
return fmt.Errorf(res.Err)
|
||||
return fmt.Errorf("%s", res.Err)
|
||||
}
|
||||
p := res.ToPeer()
|
||||
|
||||
@@ -226,15 +233,15 @@ func postCreateServiceAccount(peerID string, s *resources.StorageResource, calle
|
||||
l.Error().Msg(fmt.Sprint("Error when trying to create a serviceAccount on storage " + s.Name + " on peer at " + p.APIUrl))
|
||||
if _, ok := caller.LastResults["body"]; ok {
|
||||
l.Error().Msg(string(caller.LastResults["body"].([]byte)))
|
||||
return fmt.Errorf(string(caller.LastResults["body"].(map[string]interface{})["error"].([]byte)))
|
||||
return fmt.Errorf("%s", string(caller.LastResults["body"].(map[string]interface{})["error"].([]byte)))
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func loadWorkflow(workflowId string, peerId string) *workflow.Workflow {
|
||||
res := oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW), "", peerId, []string{}, nil).LoadOne(workflowId)
|
||||
func loadWorkflow(workflowId string) *workflow.Workflow {
|
||||
res := oclib.NewRequestAdmin(oclib.LibDataEnum(oclib.WORKFLOW), nil).LoadOne(workflowId)
|
||||
if res.Code != 200 {
|
||||
l := oclib.GetLogger()
|
||||
l.Error().Msg("Error while loading a workflow for creation of the serviceAccount")
|
||||
@@ -302,10 +309,10 @@ func getComputeProcessing(wf workflow.Workflow, processingId string) (res string
|
||||
func getServiceAccountCredentials(peerID string, storageRes resources.StorageResource, caller *tools.HTTPCaller, execId string, wfId string, computeRes resources.ComputeResource) (string, string, error) {
|
||||
l := oclib.GetLogger()
|
||||
fmt.Println("Getting a service account for" + computeRes.CreatorID + " on S3 " + storageRes.Name + " on peer " + storageRes.CreatorID)
|
||||
res := oclib.NewRequest(oclib.LibDataEnum(oclib.PEER), "", peerID, []string{}, nil).LoadOne(storageRes.CreatorID)
|
||||
res := oclib.NewRequestAdmin(oclib.LibDataEnum(oclib.PEER), nil).LoadOne(storageRes.CreatorID)
|
||||
if res.Code != 200 {
|
||||
l.Error().Msg("Error while loading a peer for creation of the serviceAccount")
|
||||
return "", "", fmt.Errorf(res.Err)
|
||||
return "", "", fmt.Errorf("%s", res.Err)
|
||||
}
|
||||
p := res.ToPeer()
|
||||
|
||||
@@ -327,19 +334,19 @@ func getServiceAccountCredentials(peerID string, storageRes resources.StorageRes
|
||||
l.Error().Msg(fmt.Sprint("Error when trying to create a serviceAccount on storage " + storageRes.Name + " on peer at " + p.APIUrl))
|
||||
if _, ok := caller.LastResults["body"]; ok {
|
||||
l.Error().Msg(string(caller.LastResults["body"].([]byte)))
|
||||
return "", "", fmt.Errorf(string(caller.LastResults["body"].(map[string]interface{})["error"].([]byte)))
|
||||
return "", "", fmt.Errorf("%s", string(caller.LastResults["body"].(map[string]interface{})["error"].([]byte)))
|
||||
}
|
||||
}
|
||||
|
||||
var access, secret string
|
||||
if a, ok := resp["access"]; !ok {
|
||||
return "", "", fmt.Errorf("Error in the response returned when creating a S3 serviceAccount on " + storageRes.Name + " on peer " + p.UUID)
|
||||
return "", "", fmt.Errorf("%s", "Error in the response returned when creating a S3 serviceAccount on "+storageRes.Name+" on peer "+p.UUID)
|
||||
} else {
|
||||
access = a.(string)
|
||||
}
|
||||
|
||||
if s, ok := resp["secret"]; !ok {
|
||||
return "", "", fmt.Errorf("Error in the response returned when creating a S3 serviceAccount on " + storageRes.Name + " on peer " + p.UUID)
|
||||
return "", "", fmt.Errorf("%s", "Error in the response returned when creating a S3 serviceAccount on "+storageRes.Name+" on peer "+p.UUID)
|
||||
} else {
|
||||
secret = s.(string)
|
||||
}
|
||||
@@ -347,13 +354,13 @@ func getServiceAccountCredentials(peerID string, storageRes resources.StorageRes
|
||||
return access, secret, nil
|
||||
}
|
||||
|
||||
func postS3Secret(peerID string, s resources.StorageResource, caller *tools.HTTPCaller, execId string, wfId string, c resources.ComputeResource, access string, secret string) error {
|
||||
func postS3Secret(s resources.StorageResource, caller *tools.HTTPCaller, execId string, wfId string, c resources.ComputeResource, access string, secret string) error {
|
||||
l := oclib.GetLogger()
|
||||
|
||||
res := oclib.NewRequest(oclib.LibDataEnum(oclib.PEER), "", peerID, []string{}, nil).LoadOne(c.CreatorID)
|
||||
res := oclib.NewRequestAdmin(oclib.LibDataEnum(oclib.PEER), nil).LoadOne(c.CreatorID)
|
||||
if res.Code != 200 {
|
||||
l.Error().Msg("Error while loading a peer for creation of the serviceAccount")
|
||||
return fmt.Errorf(res.Err)
|
||||
return fmt.Errorf("%s", res.Err)
|
||||
}
|
||||
p := res.ToPeer()
|
||||
|
||||
@@ -366,7 +373,7 @@ func postS3Secret(peerID string, s resources.StorageResource, caller *tools.HTTP
|
||||
if err != nil {
|
||||
l.Error().Msg("Error when executing on peer at " + p.APIUrl + " when creating a secret holding s3 credentials in namespace " + execId)
|
||||
l.Error().Msg(err.Error())
|
||||
return fmt.Errorf("Error when executing on peer at " + p.APIUrl + " when creating a secret holding s3 credentials" + " : " + err.Error())
|
||||
return fmt.Errorf("%s", "Error when executing on peer at "+p.APIUrl+" when creating a secret holding s3 credentials"+" : "+err.Error())
|
||||
}
|
||||
|
||||
result_code := caller.LastResults["code"].(int)
|
||||
@@ -374,7 +381,7 @@ func postS3Secret(peerID string, s resources.StorageResource, caller *tools.HTTP
|
||||
l.Error().Msg(fmt.Sprint("Error when trying to post the credential to " + s.Name + "to a secret on peer at " + p.APIUrl))
|
||||
if _, ok := caller.LastResults["body"]; ok {
|
||||
l.Error().Msg(string(caller.LastResults["body"].([]byte)))
|
||||
return fmt.Errorf(string(caller.LastResults["body"].(map[string]interface{})["error"].([]byte)))
|
||||
return fmt.Errorf("%s", string(caller.LastResults["body"].(map[string]interface{})["error"].([]byte)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,12 @@ services:
|
||||
- "traefik.http.routers.scheduler.rule=PathPrefix(`/scheduler`)"
|
||||
- "traefik.http.middlewares.scheduler-rewrite.replacepathregex.regex=^/scheduler(.*)"
|
||||
- "traefik.http.middlewares.scheduler-rewrite.replacepathregex.replacement=/oc$$1"
|
||||
- "traefik.http.routers.scheduler.middlewares=scheduler-rewrite"
|
||||
- "traefik.http.routers.scheduler.middlewares=scheduler-rewrite,auth-scheduler"
|
||||
- "traefik.http.services.scheduler.loadbalancer.server.port=8080"
|
||||
- "traefik.http.middlewares.scheduler.forwardauth.address=http://oc-auth:8080/oc/forward"
|
||||
|
||||
- "traefik.http.middlewares.auth-scheduler.forwardauth.address=http://oc-auth:8080/oc/forward"
|
||||
- "traefik.http.middlewares.auth-scheduler.forwardauth.trustForwardHeader=true"
|
||||
- "traefik.http.middlewares.auth-scheduler.forwardauth.authResponseHeaders=X-Auth-Request-User,X-Auth-Request-Email"
|
||||
ports:
|
||||
- 8090:8080
|
||||
container_name: oc-scheduler
|
||||
|
||||
10
go.mod
10
go.mod
@@ -1,11 +1,9 @@
|
||||
module oc-scheduler
|
||||
|
||||
go 1.23.0
|
||||
|
||||
toolchain go1.24.0
|
||||
go 1.24.6
|
||||
|
||||
require (
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203150531-ef916fe2d995
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260218112419-fa5c3a3c605b
|
||||
github.com/beego/beego/v2 v2.3.8
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/robfig/cron v1.2.0
|
||||
@@ -18,6 +16,7 @@ require (
|
||||
github.com/biter777/countries v1.7.5 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
@@ -30,6 +29,7 @@ require (
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/libp2p/go-libp2p/core v0.43.0-rc2 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
@@ -43,7 +43,7 @@ require (
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.65.0 // indirect
|
||||
github.com/prometheus/procfs v0.17.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.11.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.13.1 // indirect
|
||||
github.com/rs/zerolog v1.34.0 // indirect
|
||||
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
|
||||
github.com/smartystreets/assertions v1.2.0 // indirect
|
||||
|
||||
9
go.sum
9
go.sum
@@ -1,5 +1,9 @@
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203150531-ef916fe2d995 h1:ZDRvnzTTNHgMm5hYmseHdEPqQ6rn/4v+P9f/JIxPaNw=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203150531-ef916fe2d995/go.mod h1:T0UCxRd8w+qCVVC0NEyDiWIGC5ADwEbQ7hFcvftd4Ks=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260212123952-403913d8cf13 h1:DNIPQ7C+7wjbj5RUx29wLxuIe/wiSOcuUMlLRIv6Fvs=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260212123952-403913d8cf13/go.mod h1:jmyBwmsac/4V7XPL347qawF60JsBCDmNAMfn/ySXKYo=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260218112419-fa5c3a3c605b h1:ws9S0QhCiwYuxCZNi6ZfZsRvdRJ6KkkOfLT/suMrcUk=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260218112419-fa5c3a3c605b/go.mod h1:jmyBwmsac/4V7XPL347qawF60JsBCDmNAMfn/ySXKYo=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/beego/beego/v2 v2.3.8 h1:wplhB1pF4TxR+2SS4PUej8eDoH4xGfxuHfS7wAk9VBc=
|
||||
github.com/beego/beego/v2 v2.3.8/go.mod h1:8vl9+RrXqvodrl9C8yivX1e6le6deCK6RWeq8R7gTTg=
|
||||
@@ -17,6 +21,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||
github.com/etcd-io/etcd v3.3.17+incompatible/go.mod h1:cdZ77EstHBwVtD6iTgzgvogwcjo9m4iOqoijouPJ4bs=
|
||||
@@ -59,6 +65,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/libp2p/go-libp2p/core v0.43.0-rc2 h1:1X1aDJNWhMfodJ/ynbaGLkgnC8f+hfBIqQDrzxFZOqI=
|
||||
github.com/libp2p/go-libp2p/core v0.43.0-rc2/go.mod h1:NYeJ9lvyBv9nbDk2IuGb8gFKEOkIv/W5YRIy1pAJB2Q=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
@@ -102,6 +110,7 @@ github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
|
||||
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
||||
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
|
||||
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
|
||||
|
||||
@@ -167,7 +167,7 @@ func getBooking(b *booking.Booking, request *tools.APIRequest, errCh chan error,
|
||||
_, err = (&peer.Peer{}).LaunchPeerExecution(b.DestPeerID, b.ResourceID, tools.BOOKING, tools.GET, nil, &c)
|
||||
|
||||
if err != nil {
|
||||
errCh <- fmt.Errorf("error on " + b.DestPeerID + err.Error())
|
||||
errCh <- fmt.Errorf("%s", "error on "+b.DestPeerID+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*
|
||||
var errCh = make(chan error, len(bookings))
|
||||
var m sync.Mutex
|
||||
|
||||
for _, purchase := range purchases {
|
||||
for _, purchase := range purchases { // TODO on Decentralize Stream.
|
||||
go ws.CallDatacenter(purchase, purchase.DestPeerID, tools.PURCHASE_RESOURCE, request, errCh, &m)
|
||||
}
|
||||
for i := 0; i < len(purchases); i++ {
|
||||
@@ -218,7 +218,7 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*
|
||||
|
||||
errCh = make(chan error, len(bookings))
|
||||
|
||||
for _, booking := range bookings {
|
||||
for _, booking := range bookings { // TODO on Decentralize Stream.
|
||||
go ws.CallDatacenter(booking, booking.DestPeerID, tools.BOOKING, request, errCh, &m)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user