Xu_Chen
(Xu Chen)
August 27, 2014, 4:01pm
1
I have difficulty using jinja2 combined with cron module in the following way:
cron: name=test job=“abc {{ data | filter_x(‘a’) | filter_y(‘b’) }} edf”
I tried various combinations, but either the jinja2 template isn’t expanded, or I am seeing errors parsing.
Any ideas how to make something like this work? Thanks.
I assume filter_x and filter_y are plugins you wrote?
Xu_Chen
(Xu Chen)
August 27, 2014, 7:44pm
3
Yes, I wrote some additional plugins and put them in ansible/lib/runner/filter_plugins/core.py
Thanks.
Hard to say what you error is without seeing the plugin.
Perhaps you could paste it?
Xu_Chen
(Xu Chen)
August 30, 2014, 4:23am
5
Ah, thanks for the hint…
I wrote a new filter function but didn’t register it in the end. Is there a way to make such errors more obvious? Like fail the execution and tell me jinja2 template expansion failed - currently the unexpanded template is directly used as the output…
Thanks.
-Simon
Using a filter that doesn’t exist should generate an error, that I would definitely like a bug report on if you are not seeing that behavior in 1.7.X.
Thanks!