-
-
Notifications
You must be signed in to change notification settings - Fork 777
Open
Labels
Description
It's really hard to deal with magically converting from Jinja strings back into native python types. Let's just skip the conversion and use native python types.
How you ask? Jinja has merged a pretty cool PR: pallets/jinja#708
Here's a quote from the new doc:
The default
jinja2.Environmentrenders templates to strings. WithNativeEnvironment, rendering a template produces a native Python type.
This consists of three basic parts: NativeCodeGenerator, NativeTemplate, and NativeEnvironment. Check out the code. This will land in Jinja 2.10.
This comes from an ansible PR by @jctanner: ansible/ansible#23943
I suspect that using NativeEnvironment would resolve (or make a big dent in) these:
- Preserve type in ActionChain publish variables #1231 Preserve type in ActionChain published vars
- Support for complex types (lists, dictionaries, integers) for dynamic config values #2976 Complex types (other than string) in dynamic config
- for dynamic parameters (multi-type) or action-chain publishing allow explicit casting of jinja variables #3515 allow explicit casting of Jinja types
- Add extra_vars parsing directives due to Jinja StackStorm-Exchange/stackstorm-ansible#14 Parsing directives !JSON, !AST, and !INT that convert strings (like from Jinja) to python types.
- Plus, maybe it would be one component in allowing complex (ie non-string) data types in the datastore.
arm4b and Kamiarm4b, Kami and namachieli