Brian Coca
e938f554b7
better exception handling for unexpected exceptions
11 years ago
Brian Coca
9a5cbf747a
fine tuned lookup/templating errors
11 years ago
Brian Coca
7d2937b1cc
minor fixes to template function
...
- make sure it calls itself correctly, now passes same params as it recieves
- vars is reserved, changed for templatevars to avoid confustion
- forcing mustaches again since the removal broke 'listification' as per #9622
- fixes incorrectly successful tests using undefined var, now it is defined
- now returns empty list if items is None to avoid errors
11 years ago
James Cammarata
b61a78532c
Catch template syntax errors specifically when templating strings
...
Fixes #9333
11 years ago
James Cammarata
128c10b311
Don't template 'vars' dictionary during templating
...
Fixes #9132
11 years ago
Michael DeHaan
8c4161d4a1
Merge branch 'retf_py' of git://github.com/berendt/ansible into devel
...
Conflicts:
lib/ansible/inventory/vars_plugins/group_vars.py
plugins/callbacks/mail.py
12 years ago
James Cammarata
a9f0f8e975
Revert "template.py: Handle purposely raised exceptions in lookup()"
...
This reverts commit 2fda9bc743 .
12 years ago
James Cammarata
0e5b0a2e97
Revert "Set Jinja2's keep_trailing_newline=True in template_from_string."
...
This reverts commit 7a8eb0b670 .
12 years ago
Jacob Leverich
7a8eb0b670
Set Jinja2's keep_trailing_newline=True in template_from_string.
...
Without this setting, the newline idempotence of scalar strings changes depending on whether
or not they contain any Jinja2 template blocks.
12 years ago
Henry Finucane
de64bbdc5f
Support a whitelisted subset of jinja2 template options
12 years ago
James Cammarata
8ed6350e65
When parsing json from untrusted sources, remove templating tags
12 years ago
Paul Sokolovsky
f8bf9cdeec
Handle TemplateNotFound to render more helpful error message.
...
At the point the exception is handled, it is likely due to error loading
a sub-template included from main template. Besides file not found, it
can be caused also by include path failing Jinja2 checks. Now, when
rendering the exception from Jinja, it will include exception name. This
will give basic context or *what* the error is.
Fixes #7103
Fixes #7105
12 years ago
Jack Neely
2fda9bc743
template.py: Handle purposely raised exceptions in lookup()
...
If a lookup plugin is run by the lookup() template method it should pass
along any AnsibleError (or child exception classes) rather than just eat
them. These exceptions are purposely raised by the plugin.
12 years ago
Christian Berendt
6676720ce5
fixed typos found by RETF rules in PY files
...
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos
12 years ago
James Tanner
5a65dc3b6a
Fixes #6820 fix erroneous missing vault password error when using the template module
12 years ago
James Tanner
2a976ac313
Fixes #5059 Ignore lookup failures when templating a task name
12 years ago
James Cammarata
8c7828d469
Tweaking error message resulting from undefined template variables
...
Fixes #5114
12 years ago
James Tanner
ad70e9bcd6
Fixes #6227 skip non-unicode strings and catch decode errors silently in template_from_string
12 years ago
Michael DeHaan
d1753046e0
Revert "Correctly catch template errors without returning invalid data"
...
This reverts commit 3cd7d47b7e .
12 years ago
James Cammarata
3cd7d47b7e
Correctly catch template errors without returning invalid data
...
Fixes #6329
12 years ago
Michael DeHaan
46ec8759d5
Remove the legacy templating code, which was guarded by deprecation warnings in the previous two releases, and undocumented for a long time. use {{ foo }} to access variables instead of ${foo} or $foo.
12 years ago
James Cammarata
a72dc2ec34
Use finalize method in jinja2 to convert None values to empty strings
...
Fixes #4812
12 years ago
James Cammarata
959a156195
Properly count newlines appearing at the end of templates after rendering
...
Fixes #4633
12 years ago
James Cammarata
3fddd78ec5
Fixing traceback caused by incorrect argument passing to json.dumps
...
Fixes #5756
12 years ago
James Tanner
21fdb2bbc7
Fixes #5200 Handle template contents with unicode strings better
12 years ago
Janez Nemanic
8752ae6909
Fix for issue #4730 - stacktrace when deferenencing a non-existent group
12 years ago
James Cammarata
9101c2af98
Fix traceback in template error detection code
...
Fixes #5081
12 years ago
Antonio Zanardo
8dbd91b5ad
fix typo in deprecation warning
12 years ago
Michael DeHaan
fc909b453f
Make the legacy template detection system not hit a false positive when
...
replacing a \$ with $.
12 years ago
Michael DeHaan
90cce35919
This allows variable references in playbooks in a different way.
12 years ago
James Tanner
d154bf8781
Revert templating enhancements from 73dbab70 e6c28658 d409352c 9858b1f2 4587528b 9b1fe455 214b0b05 8d3db803 7f9504d1 5031104c 35cb9dc2 2bd8cb57 1e85c754
12 years ago
Michael DeHaan
73dbab702f
Don't run lookup plugins while trying to simplify the input datastructure.
12 years ago
Michael DeHaan
4587528b99
Fix typo in comment.
12 years ago
Michael DeHaan
d409352c85
Remove some interior imports in the code. Not really needed but nice to have them gone.
12 years ago
Michael DeHaan
e6c28658b4
Add in some code to pre-template datastructures prior to template usage. This prevents a certain class of error
...
where filter evaluations can happen too early due to the template engine recursion being a bit limited.
Addresses #4662
12 years ago
Michael DeHaan
9858b1f2f3
Enable imports to work on a snippet based system, allowing for instance a library of common EC2 functions
...
to be reused between modules. See library/system/service and library/system/ping for initial examples. Can
work the old way to just import 'basic', or can import the new way to import multiple pieces of code from
module_utils/.
12 years ago
James Tanner
9b1fe455c6
Fixes #4549 Do not call lookup plugins when templating a task's name
12 years ago
James Tanner
214b0b052c
Fixes #4608 add lookup to template globals to make plugins work again
12 years ago
Michael DeHaan
2bd8cb5790
Make the deprecation detector in templates more accurate. Fixes #4514 .
12 years ago
Michael DeHaan
7f9504d14d
Fix a typo.
12 years ago
Michael DeHaan
8d3db80370
Some misc cleanup and removal of unused imports.
12 years ago
Michael DeHaan
5031104c3a
Finishing touches on template cleanup.
12 years ago
Michael DeHaan
1e85c7544b
Further WIP on template cleanup.
12 years ago
Michael DeHaan
35cb9dc22f
Work in progress about cleaning up template code.
12 years ago
Tomaz Muraus
922f61899e
Throw a more user-friendly exception during template rendering process.
12 years ago
Michael DeHaan
add45d2ca9
Fixup legacy var detector.
12 years ago
Michael DeHaan
a45494a896
Add warnings feature.
12 years ago
Michael DeHaan
9637f620d7
Deprecation warnings of several flavors, nice and purple and can be disabled
...
in ansible.cfg.
12 years ago
Michael DeHaan
c69e19c6a6
Enhance references to logging functionality. Fixes #3431 .
12 years ago
Matt Coddington
7f7116de3b
commit 9db4f7a made a change that also needed to include this to retain correct legacy_playbook_variables behavior
12 years ago