Upgrade pre shuffle-shared merge

This commit is contained in:
frikky
2021-03-21 18:01:09 +01:00
parent 4f49a87a21
commit 6574f122f1
6 changed files with 94 additions and 33 deletions
+3 -3
View File
@@ -141,11 +141,11 @@ class AppBase:
print(f"VALUE APPEND: {value}")
param_value += value
if param["name"] not in param_names:
param_names.append(param["name"])
except (KeyError, NameError) as e:
print(f"Key/NameError in param handler: {e}")
print(f"""Key/NameError in param handler for {param["name"]}: {e}""")
print(f"OUTER VALUE: {param_value}")
if len(param_value) > 0:
@@ -2292,7 +2292,7 @@ class AppBase:
if action_result["result"] == "":
action_result["result"] = result
self.logger.debug(f"Executed {action['label']}-{action['id']} with result: {result}")
self.logger.debug(f"Executed {action['label']}-{action['id']}")#with result: {result}")
#self.logger.debug(f"Data: %s" % action_result)
except TypeError as e:
print("TypeError issue: %s" % e)
+6 -8
View File
@@ -429,15 +429,13 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
)
// Use lowercase when checking
/*
if strings.Contains(functionname, "login") {
//log.Printf("FUNCTION: %s", data)
log.Println(data)
log.Printf("Queries: %s", queryString)
}
*/
//log.Printf(data)
if strings.Contains(functionname, "attachment") {
//log.Printf("FUNCTION: %s", data)
//log.Println(data)
//log.Printf("Queries: %s", queryString)
}
return functionname, data
}
+26 -2
View File
@@ -3405,7 +3405,7 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) {
//resp.WriteHeader(200)
//resp.Write([]byte(`{"success": true}`))
if hook.Status == "stopped" {
log.Printf("Not running %s because hook status is stopped", hook.Id)
log.Printf("[WARNING] Not running %s because hook status is stopped", hook.Id)
resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "The webhook isn't running. Click start to start it"}`)))
return
@@ -3436,10 +3436,34 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) {
return
}
//log.Printf("BODY: %s", parsedBody)
// This is a specific fix for MSteams and may fix other things as well
// Scared whether it may stop other things though, but that's a future problem
// (famous last words)
parsedBody := string(body)
if strings.Contains(parsedBody, "choice") {
if strings.Count(parsedBody, `\\n`) > 2 {
parsedBody = strings.Replace(parsedBody, `\\n`, "", -1)
}
if strings.Count(parsedBody, `\u0022`) > 2 {
parsedBody = strings.Replace(parsedBody, `\u0022`, `"`, -1)
}
if strings.Count(parsedBody, `\\"`) > 2 {
parsedBody = strings.Replace(parsedBody, `\\"`, `"`, -1)
}
if strings.Contains(parsedBody, `"extra": "{`) {
parsedBody = strings.Replace(parsedBody, `"extra": "{`, `"extra": {`, 1)
parsedBody = strings.Replace(parsedBody, `}"}`, `}}`, 1)
}
}
//log.Printf("\n\nPARSEDBODY: %s", parsedBody)
newBody := ExecutionStruct{
Start: hook.Start,
ExecutionSource: "webhook",
ExecutionArgument: string(body),
ExecutionArgument: parsedBody,
}
b, err := json.Marshal(newBody)
+8 -2
View File
@@ -981,6 +981,10 @@ func validateNewWorkerExecution(body []byte) error {
return errors.New(fmt.Sprintf("Bad length of trigger: %d (probably normal app)", len(execution.Workflow.Triggers)))
}
if baseExecution.Status != "WAITING" && baseExecution.Status != "EXECUTING" {
return errors.New(fmt.Sprintf("Workflow is already finished or failed. Can't update"))
}
if execution.Status == "EXECUTING" {
//log.Printf("[INFO] Inside executing.")
extra := 0
@@ -994,6 +998,8 @@ func validateNewWorkerExecution(body []byte) error {
if len(execution.Workflow.Actions)+extra == len(execution.Results) {
execution.Status = "FINISHED"
}
log.Printf("BASEEXECUTION LENGTH: %d", len(baseExecution.Workflow.Actions)+extra)
}
// FIXME: Add extra here
@@ -3699,14 +3705,14 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
Status: "SKIPPED",
})
} else {
log.Printf("SHOULD KEEP TRIGGER %s", trigger.ID)
//log.Printf("SHOULD KEEP TRIGGER %s", trigger.ID)
}
}
}
//childNodes := findChildNodes(workflowExecution, workflowExecution.Start)
if !startFound {
log.Printf("Startnode %s doesn't exist!", workflowExecution.Start)
log.Printf("[ERROR] Startnode %s doesn't exist!!", workflowExecution.Start)
return WorkflowExecution{}, fmt.Sprintf("Workflow action %s doesn't exist in workflow", workflowExecution.Start), errors.New(fmt.Sprintf(`Workflow start node "%s" doesn't exist. Exiting!`, workflowExecution.Start))
}