fix[user-input]: making it work for onprem
This commit is contained in:
@@ -577,6 +577,8 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if len(actionResult.ExecutionId) > 0 {
|
if len(actionResult.ExecutionId) > 0 {
|
||||||
log.Printf("[WARNING][%s] Failed getting execution (streamresult): %s", actionResult.ExecutionId, err)
|
log.Printf("[WARNING][%s] Failed getting execution (streamresult): %s", actionResult.ExecutionId, err)
|
||||||
|
} else {
|
||||||
|
log.Printf("[WARNING] Execution ID is empty in stream result")
|
||||||
}
|
}
|
||||||
resp.WriteHeader(401)
|
resp.WriteHeader(401)
|
||||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`)))
|
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`)))
|
||||||
@@ -1056,24 +1058,29 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
workflowExecution, execInfo, _, err := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth))
|
workflowExecution, execInfo, _, workflowExecErr := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth))
|
||||||
if err != nil {
|
if workflowExecErr != nil {
|
||||||
err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true)
|
err := shuffle.SetWorkflowExecution(ctx, workflowExecution, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err)
|
log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(fmt.Sprintf("%s", err), "User Input") {
|
if strings.Contains(fmt.Sprintf("%s", workflowExecErr), "User Input") {
|
||||||
// Special for user input callbacks
|
// Special for user input callbacks
|
||||||
return workflowExecution, fmt.Sprintf("%s", err), nil
|
log.Printf("[INFO] User input callback: %s", err)
|
||||||
|
// return workflowExecution, fmt.Sprintf("%s", err), nil
|
||||||
} else {
|
} else {
|
||||||
|
if err == nil && workflowExecErr != nil {
|
||||||
|
err = workflowExecErr
|
||||||
|
}
|
||||||
|
|
||||||
log.Printf("[ERROR] Failed in prepareExecution: '%s'", err)
|
log.Printf("[ERROR] Failed in prepareExecution: '%s'", err)
|
||||||
return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err
|
return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
err = imageCheckBuilder(execInfo.ImageNames)
|
err := imageCheckBuilder(execInfo.ImageNames)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err)
|
log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err)
|
||||||
return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err
|
return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err
|
||||||
@@ -1336,6 +1343,17 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if previous result.action.app_name was shuffle-subflow
|
||||||
|
if len(workflowExecution.Results) > 0 {
|
||||||
|
lastResult := workflowExecution.Results[len(workflowExecution.Results)-1]
|
||||||
|
if lastResult.Action.AppName == "shuffle-subflow" {
|
||||||
|
log.Printf("LAST RESULT: %s", lastResult.Action.AppName)
|
||||||
|
|
||||||
|
// newStartnode = "a4b01316-2d6d-4b25-9560-2f5586e1a770"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if !startnodeFound {
|
if !startnodeFound {
|
||||||
log.Printf("[INFO] Couldn't find startnode %s. Remapping to %#v", workflowExecution.Start, newStartnode)
|
log.Printf("[INFO] Couldn't find startnode %s. Remapping to %#v", workflowExecution.Start, newStartnode)
|
||||||
|
|
||||||
@@ -1346,6 +1364,8 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("[INFO] Starting execution on %s", workflowExecution.Start)
|
||||||
|
|
||||||
childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start, []string{}, []string{})
|
childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start, []string{}, []string{})
|
||||||
|
|
||||||
startFound := false
|
startFound := false
|
||||||
|
|||||||
Reference in New Issue
Block a user