Use python3 and ast.literal_eval
name: "dump_results"
ref: "core.local"
parameters:
- cmd: "echo \"{{__results}}\" | python2 -c \"import json; import sys; from datetime import datetime; diag_data=eval(sys.stdin.read()); diag_data['timestamp'] = str(datetime.now()); print(json.dumps(diag_data))\" >> /tmp/diag_loadavg.json && echo 'Output written to file /tmp/diag_loadavg.json'"
+ cmd: >
+ echo "{{__results}}"
+ | python3 -c
+ 'import ast, datetime, json, sys;
+ diag_data=ast.literal_eval(sys.stdin.read());
+ diag_data["timestamp"] = str(datetime.datetime.now());
+ print(json.dumps(diag_data))'
+ >> /tmp/diag_loadavg.json
+ && echo 'Output written to file /tmp/diag_loadavg.json'
default: "check_load"
