Skip to content

Commit a9c9f71

Browse files
fix step execution with list vairables
1 parent 302f3f8 commit a9c9f71

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

executor/tasks.py

Lines changed: 11 additions & 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,16 @@ 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(',')
107+
bulk_value = execution_global_variable_set[bulk_task_var]
108+
try:
109+
parsed = json.loads(bulk_value)
110+
if isinstance(parsed, list):
111+
bulk_execution_var_values = parsed
112+
else:
113+
bulk_execution_var_values = bulk_value.split(',')
114+
except Exception:
115+
bulk_execution_var_values = bulk_value.split(',')
116+
107117
if not bulk_execution_var_values:
108118
task_result = PlaybookTaskResult(
109119
error=StringValue(value="Bulk execution variable values not found in global variables"))

0 commit comments

Comments
 (0)