Skip to content

Commit f70e356

Browse files
committed
fun_args also needs to be JSON dumped so that Elastic Search doesn't complain
Signed-off-by: Pedro Algarvio <[email protected]>
1 parent 7f3ec98 commit f70e356

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/src/saltext/safexamples/process/jobs_to_es.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ async def process(
4646
data = event.dict()
4747
data.pop("data", None)
4848
data.update(event.data)
49-
# Have the return field always be a JSON string
50-
if "return" in data:
51-
data["return"] = json.dumps(data["return"])
49+
# Some field must be cast to JSON strings or EL will complain about
50+
# different types
51+
for key in ("fun_args", "return"):
52+
if key in data:
53+
data[key] = json.dumps(data[key])
5254
data["@timestamp"] = event.start_time
5355
evt = ElasticSearchEvent.construct(index="salt_jobs", data=data)
5456
log.debug("ElasticSearchEvent: %s", pprint.pformat(evt.dict()))

0 commit comments

Comments
 (0)