Expand description
Template rendering — {{ workload.var }} / {{ step.result }} /
{{ result.path }} substitution with a minimal filter set.
Extracted from repos/cli/src/playbook_runner.rs lines 1448-2006
in R-1.1 PR-2b per § H.10.3 of Appendix H of the global hybrid
cloud blueprint. The CLI’s tree walker (playbook_runner.rs)
and the worker’s NATS-mode runner both render templates the same
way; this module is the shared implementation they call into.
Functions take &HashMap<String, String> slices of the
per-execution variables and step results so each binary owns its
own context shape but feeds the same data into rendering.
Functions§
- get_
json_ path - Get a value from JSON using a path like
"status","body.name", or"items[0].id". - json_
to_ rhai - Convert a
serde_json::Valueinto arhai::Dynamicfor scripting. - render_
template - Render a template by substituting
{{ var }},{{ var | filter }},{{ workload.var }},{{ vars.var }}, and{{ step.result }}references against the supplied variable + step-result maps. - render_
template_ with_ result - Render a template that may reference
{{ result.path }}against the supplied JSON result value (e.g. the previous step’s HTTP response body), then apply the regularrender_templatepass for the rest of the references. - rhai_
to_ json_ string - Stringify a
rhai::Dynamicvalue into a JSON-shaped string for embedding into rendered output.