Feature: Added contains_any_of to conditions

This commit is contained in:
frikky
2020-12-24 07:35:27 +01:00
parent 8a99fb6048
commit c2cf104700
7 changed files with 69 additions and 17 deletions
+16
View File
@@ -1127,6 +1127,22 @@ class AppBase:
elif check.lower() == "contains":
if destinationvalue.lower() in sourcevalue.lower():
return True
elif check.lower() == "contains_any_of":
newvalue = [destinationvalue.lower()]
if "," in destinationvalue:
newvalue = destinationvalue.split(",")
elif ", " in destinationvalue:
newvalue = destinationvalue.split(", ")
for item in new_value:
if not item:
continue
if item.trim() in sourcevalue:
print("[INFO] Found %s in %s" % (item, sourcevalue))
return True
return False
elif check.lower() == "larger than":
try:
if sourcevalue.isdigit() and destinationvalue.isdigit():
+8 -6
View File
@@ -785,7 +785,7 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) {
ctx := context.Background()
workflowExecution, err := getWorkflowExecution(ctx, actionResult.ExecutionId)
if err != nil {
log.Printf("Failed getting execution (streamresult) %s: %s", actionResult.ExecutionId, err)
//log.Printf("Failed getting execution (streamresult) %s: %s", actionResult.ExecutionId, err)
resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`)))
return
@@ -1004,7 +1004,7 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
}
if actionResult.Status == "ABORTED" || actionResult.Status == "FAILURE" {
log.Printf("Actionresult is %s. Should set workflowExecution and exit all running functions", actionResult.Status)
log.Printf("[WARNING] Actionresult is %s. Should set workflowExecution and exit all running functions", actionResult.Status)
newResults := []ActionResult{}
childNodes := []string{}
@@ -1016,7 +1016,7 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
// Finds ALL childnodes to set them to SKIPPED
childNodes = findChildNodes(*workflowExecution, actionResult.Action.ID)
// Remove duplicates
log.Printf("CHILD NODES: %d", len(childNodes))
//log.Printf("CHILD NODES: %d", len(childNodes))
for _, nodeId := range childNodes {
if nodeId == actionResult.Action.ID {
continue
@@ -1290,7 +1290,7 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
}
if _, err = tx.Commit(); err != nil {
if attempts >= 5 {
if attempts >= 7 {
log.Printf("[ERROR] QUITTING: tx.Commit %d: %v", attempts, err)
tx.Rollback()
workflowExecution.Status = "ABORTED"
@@ -1301,7 +1301,9 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
return
}
log.Printf("[WARNING] tx.Commit %d: %v", attempts, err)
if attempts > 3 {
log.Printf("[WARNING] tx.Commit %d: %v", attempts, err)
}
attempts += 1
runWorkflowExecutionTransaction(ctx, attempts, workflowExecutionId, actionResult, resp)
@@ -2604,7 +2606,7 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
}
// This one doesn't really matter.
log.Printf("Running POST execution with data %s", body)
log.Printf("Running POST execution with body of length %d", len(string(body)))
var execution ExecutionRequest
err = json.Unmarshal(body, &execution)
if err != nil {