Skip to content

Commit adaa9f8

Browse files
fix step execution
1 parent ec511c8 commit adaa9f8

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

executor/playbook_result_conditional_evaluators/step_condition_evaluator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def evaluate(self, condition: PlaybookStepResultCondition,
7373

7474
variable_rules: [PlaybookTaskResultRule] = rs.variable_rules
7575
for vr in variable_rules:
76-
variable_evaluator = self._variable_rule_map.get(vr.type)
76+
variable_evaluator = self._variable_rule_map.get()
77+
print("WOOOOOOO 0", variable_evaluator, vr)
7778
global_variable_set = next(
7879
(tr.execution_global_variable_set for tr in playbook_task_execution_log), None)
7980
if not variable_evaluator:

executor/playbook_result_conditional_evaluators/task_result_evalutors/global_variable_evaluator.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from executor.playbook_result_conditional_evaluators.task_result_evalutors.task_result_evaluator import TaskResultEvaluator
22
from protos.base_pb2 import Operator
33
from protos.playbooks.playbook_commons_pb2 import PlaybookTaskResultType
4-
from protos.playbooks.playbook_pb2 import PlaybookTaskResultRule
54
from protos.playbooks.playbook_global_variable_evaluator_pb2 import GlobalVariableResultRule
65
from utils.proto_utils import proto_to_dict
76
from google.protobuf.struct_pb2 import Struct
@@ -26,17 +25,21 @@ def function_result_operator_threshold(value, operator, threshold):
2625

2726
class GlobalVariabletEvaluator(TaskResultEvaluator):
2827

29-
def evaluate(self, rule: PlaybookTaskResultRule, global_variable_set: Struct) -> (bool, dict):
28+
def evaluate(self, rule: GlobalVariableResultRule, global_variable_set: Struct) -> (bool, dict):
3029
if rule.type != PlaybookTaskResultType.GLOBAL_VARIABLE:
3130
raise ValueError("Received unsupported rule and task types")
32-
global_variable_rule: GlobalVariableResultRule = rule.global_variable
33-
variable_name = global_variable_rule.variable_name
34-
operator = global_variable_rule.operator
35-
threshold = global_variable_rule.threshold.value
3631

37-
global_variable_set_dict = proto_to_dict(global_variable_set)
32+
print("WOOOOOOO 1", rule)
33+
variable_name = rule.variable_name
34+
operator = rule.operator
35+
threshold = rule.threshold.value
36+
37+
global_variable_set_dict = proto_to_dict(global_variable_set) if global_variable_set else {}
3838
value = global_variable_set_dict.get(variable_name, None)
3939

40+
print("WOOOOOOO 2", global_variable_set_dict, value)
41+
42+
4043
if not value:
4144
return False, {'value': value}
4245

executor/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import logging
23

34
from celery import shared_task
@@ -103,7 +104,6 @@ def execute_playbook_step_impl(tr: TimeRange, account: Account, step: PlaybookSt
103104
execution_global_variable_set=execution_global_variable_set))
104105
continue
105106

106-
bulk_execution_var_values = execution_global_variable_set[bulk_task_var].split(',')
107107
if not bulk_execution_var_values:
108108
task_result = PlaybookTaskResult(
109109
error=StringValue(value="Bulk execution variable values not found in global variables"))

0 commit comments

Comments
 (0)