Many fixes for frontend and backend related to Oauth2 and environment control
This commit is contained in:
@@ -1965,6 +1965,7 @@ func executeCloudAction(action shuffle.CloudSyncJob, apikey string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
defer newresp.Body.Close()
|
||||
respBody, err := ioutil.ReadAll(newresp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -3513,15 +3514,13 @@ func remoteOrgJobHandler(org shuffle.Org, interval int) error {
|
||||
)
|
||||
|
||||
req.Header.Add("Authorization", fmt.Sprintf(`Bearer %s`, org.SyncConfig.Apikey))
|
||||
|
||||
//log.Printf("[INFO] Sending org sync with autho %s", org.SyncConfig.Apikey)
|
||||
|
||||
newresp, err := client.Do(req)
|
||||
if err != nil {
|
||||
//log.Printf("Failed request in org sync: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
defer newresp.Body.Close()
|
||||
respBody, err := ioutil.ReadAll(newresp.Body)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Failed body read in job sync: %s", err)
|
||||
@@ -3574,6 +3573,8 @@ func runInitEs(ctx context.Context) {
|
||||
log.Printf("[DEBUG] Getting organizations for Elasticsearch/Opensearch")
|
||||
activeOrgs, err := shuffle.GetAllOrgs(ctx)
|
||||
|
||||
log.Printf("[DEBUG] Got %d organizations to look into", len(activeOrgs))
|
||||
|
||||
setUsers := false
|
||||
_ = setUsers
|
||||
if err != nil {
|
||||
@@ -3697,7 +3698,7 @@ func runInitEs(ctx context.Context) {
|
||||
|
||||
for _, schedule := range schedules {
|
||||
if strings.ToLower(schedule.Environment) == "cloud" {
|
||||
log.Printf("Skipping cloud schedule")
|
||||
log.Printf("[DEBUG] Skipping cloud schedule")
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -3705,7 +3706,9 @@ func runInitEs(ctx context.Context) {
|
||||
//log.Printf("Schedule time: every %d seconds", schedule.Seconds)
|
||||
jobret, err := newscheduler.Every(schedule.Seconds).Seconds().NotImmediately().Run(job(schedule))
|
||||
if err != nil {
|
||||
log.Printf("Failed to schedule workflow: %s", err)
|
||||
log.Printf("[ERROR] Failed to start schedule for workflow %s: %s", schedule.WorkflowId, err)
|
||||
} else {
|
||||
log.Printf("[DEBUG] Successfully started schedule for workflow %s", schedule.WorkflowId)
|
||||
}
|
||||
|
||||
scheduledJobs[schedule.Id] = jobret
|
||||
@@ -4725,7 +4728,7 @@ func initHandlers() {
|
||||
log.Printf("[DEBUG] Initialized Shuffle database connection. Setting up environment.")
|
||||
|
||||
if elasticConfig == "elasticsearch" {
|
||||
time.Sleep(5 * time.Second)
|
||||
time.Sleep(10 * time.Second)
|
||||
go runInitEs(ctx)
|
||||
} else {
|
||||
//go shuffle.runInit(ctx)
|
||||
|
||||
@@ -705,7 +705,7 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
|
||||
|
||||
// Will make sure transactions are always ran for an execution. This is recursive if it fails. Allowed to fail up to 5 times
|
||||
func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workflowExecutionId string, actionResult shuffle.ActionResult, resp http.ResponseWriter) {
|
||||
log.Printf("[DEBUG] Running workflow execution transaction for %s", workflowExecutionId)
|
||||
log.Printf("[DEBUG][%s] Running workflow execution update", workflowExecutionId)
|
||||
|
||||
// Should start a tx for the execution here
|
||||
workflowExecution, err := shuffle.GetWorkflowExecution(ctx, workflowExecutionId)
|
||||
@@ -1063,10 +1063,6 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
||||
}
|
||||
}
|
||||
|
||||
err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err)
|
||||
}
|
||||
|
||||
err = imageCheckBuilder(execInfo.ImageNames)
|
||||
if err != nil {
|
||||
@@ -1573,6 +1569,11 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
||||
workflowExecution.ExecutionOrg = workflow.ExecutingOrg.Id
|
||||
}
|
||||
|
||||
err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err)
|
||||
}
|
||||
|
||||
var allEnvs []shuffle.Environment
|
||||
if len(workflowExecution.ExecutionOrg) > 0 {
|
||||
//log.Printf("[INFO] Executing ORG: %s", workflowExecution.ExecutionOrg)
|
||||
|
||||
Reference in New Issue
Block a user