#34: Added variables as static arguments

This commit is contained in:
frikky
2020-06-02 17:01:37 +02:00
parent b90577edd2
commit 44fc592586
+16 -5
View File
@@ -114,18 +114,29 @@ class AppBase:
# 1. Find the action # 1. Find the action
baseresult = "" baseresult = ""
actionname_lower = actionname.lower()
try: try:
if actionname.lower() == "exec": if actionname_lower == "exec":
baseresult = execution_data["execution_argument"] baseresult = execution_data["execution_argument"]
else: else:
for result in execution_data["results"]: for result in execution_data["results"]:
resultlabel = result["action"]["label"].replace(" ", "_", -1).lower() resultlabel = result["action"]["label"].replace(" ", "_", -1).lower()
if resultlabel.lower() == actionname.lower(): if resultlabel.lower() == actionname_lower:
baseresult = result["result"] baseresult = result["result"]
break break
print("BEFORE VARIABLES!")
if len(baseresult) == 0:
print("Variables: %s" % execution_data["workflow"]["workflow_variables"])
for variable in execution_data["workflow"]["workflow_variables"]:
variablename = variable["name"].replace(" ", "_", -1).lower()
if variablename.lower() == actionname_lower:
baseresult = variable["value"]
break
except KeyError as error: except KeyError as error:
print(f"Error: {error}") print(f"KeyError in JSON: {error}")
print(f"After first trycatch") print(f"After first trycatch")
@@ -187,7 +198,7 @@ class AppBase:
self.logger.debug(f"\n\nHandle static data with JSON: {data}\n\n") self.logger.debug(f"\n\nHandle static data with JSON: {data}\n\n")
actualitem = re.findall(match, data, re.MULTILINE) actualitem = re.findall(match, data, re.MULTILINE)
self.logger.info("PARSED: %s" % actualitem) self.logger.info("STATIC PARSED: %s" % actualitem)
if len(actualitem) > 0: if len(actualitem) > 0:
for replace in actualitem: for replace in actualitem:
try: try:
@@ -238,7 +249,7 @@ class AppBase:
self.logger.info("Fullname: %s" % fullname) self.logger.info("Fullname: %s" % fullname)
actualitem = re.findall(match, fullname, re.MULTILINE) actualitem = re.findall(match, fullname, re.MULTILINE)
self.logger.info("PARSED: %s" % actualitem) self.logger.info("ACTION PARSED: %s" % actualitem)
if len(actualitem) > 0: if len(actualitem) > 0:
for replace in actualitem: for replace in actualitem:
try: try: