Matthew Thode
c0a7f51671
tests depend on the default encoding being utf8
...
So we set the utils default encoding to be utf8
11 years ago
James Tanner
d154bf8781
Revert templating enhancements from 73dbab70
e6c28658
d409352c
9858b1f2
4587528b
9b1fe455
214b0b05
8d3db803
7f9504d1
5031104c
35cb9dc2
2bd8cb57
1e85c754
11 years ago
Michael DeHaan
5031104c3a
Finishing touches on template cleanup.
11 years ago
Michael DeHaan
35cb9dc22f
Work in progress about cleaning up template code.
11 years ago
Michael DeHaan
2032489617
Prune legacy tests -- many of these are not part of the official API or documented syntax.
11 years ago
Michael DeHaan
e8b043332f
Remove some obsolete tests (mechanism of error detection suboptimal, replacements pending)
11 years ago
Michael DeHaan
ef28d62846
Update TestUtils.py
...
tests shouldn't be making symlinks to system dirs, also fixes unit test report on OS X.
11 years ago
Michael Scherer
399d57a651
add more tests :
...
- test part of ansible.runner.filter_plugins.core
- test ansible.utils.unfrackpath
11 years ago
Stoned Elipot
a1503c4d59
stringify conditional before handing it to Jinja2 for evaluation.
...
This should fix simple conditionals like:
when: ansible_selinux
While here add tests for ansible.utils.check_conditional() in
"jinja2_compare mode".
11 years ago
Dale Sedivec
b32131c867
expanduser on each component of plug-in paths
...
ansible.constants was calling expanduser (by way of shell_expand_path)
on the entire configured value for the library and *_plugins
configuration values, but these values have always been interpreted as
multiple directories separated by os.pathsep. Thus, if you supplied
multiple directories for one of these values, typically only the first
(at least on *nix) would have e.g. "~" expanded to HOME.
Now PluginLoader does expansion on each individual path in each of
these variables.
12 years ago
Michael DeHaan
81a926547c
Some continued work on new-style templates and associated test code changes. Legacy template functions
...
are marked with "legacy_" for possible future removal.
12 years ago
Michael DeHaan
b09ef21ec9
Add code to flag legacy templating like $foo.{bar} as deprecated in favor of Jinja2 {{ foo.bar }} so we
...
can remove the legacy system at a later date.
12 years ago
Daniel Hokka Zakrisson
a79373f6b2
Make template_ds the only templater
...
Instead of having to remember when to use which one, rename template_ds
to template and move the last bit of code from template to varReplace
(which gets used for all string replacements, in the end).
This means that you can template any data type without worrying about
whether it's a string or not, and the right thing will happen.
12 years ago
Daniel Hokka Zakrisson
87b2378e22
Resolve variable references inside variables
...
Fixes the case where variable x is '$y' and y is a dict(foo='bar') and
an attempt to access ${x.foo} is made.
12 years ago
Daniel Hokka Zakrisson
e74ffd6764
Lookup plugin arguments need to be templated
12 years ago
Daniel Hokka Zakrisson
d2dce1d63f
Make lookup plugin replacements part of the main variable logic
12 years ago
Daniel Hokka Zakrisson
383dc30560
Rename varReplaceWithItems to template_ds
12 years ago
Daniel Hokka Zakrisson
47082a9171
Add $LOOKUP(<lookup plugin>,<data>) as a templating option
...
Also moves file and pipe to lookup_plugins.
12 years ago
Daniel Hokka Zakrisson
56314f7225
Add test case for non-existing variable in varReplaceWithItems
12 years ago
Daniel Hokka Zakrisson
efe83daf19
Fix ${var.$other_var} and add test cases for it
12 years ago
Daniel Hokka Zakrisson
c9c5fc1456
Merge varFind and varLookup
12 years ago
Michael DeHaan
6fa1a49037
Fix the basic templating system such that when the template ends in '$', life continues as normal.
12 years ago
Michael DeHaan
0837a29e51
Only expand lists in templating inside of module action lines, to avoid breaking usage with with_items and "in" statements, etc
12 years ago
Daniel Hokka Zakrisson
695b4bcb46
Allow non-string types in with_items variables
12 years ago
Michael DeHaan
22f3aef4dc
remove test for private function that is no longer present
12 years ago
Daniel Hokka Zakrisson
dfee6e19ca
Replace lists with a comma-separated join
12 years ago
Daniel Hokka Zakrisson
4b29c2cf74
Revert pull request #1091
...
Automatic quoting of variables in only_if breaks existing playbooks
where entire statements are put in a variable, and other cases. See
issue #1120 for details.
12 years ago
Michael DeHaan
06cfc52afd
fix tests and change nosetests flags so asserts show what comparisons failed
12 years ago
Daniel Hokka Zakrisson
9e4fac5ebd
Create a string parser for varReplace instead of using re
...
This fixes a few issues,
- ${foo}${bar} would be parsed as a variable named foo}${bar,
which wouldn't be easily fixed without breaking ${foo.${bar}}
- allows escaping . in variable parts so e.g.
${hostvars.{test.example.com}.foo} works
This is slower than using re. 3 million templating calls take about
about twice as long to complete with this compared to the regexp,
from ~65 seconds to ~115 seconds on my laptop.
12 years ago
Daniel Hokka Zakrisson
b55ef665ba
Fix only_if statements referencing non-string types
...
This fixes e.g. only_if: ${task.changed} which would always
evaluate to true due to it having been replaced by a string for its
boolean value. Also adds a test case to ensure it doesn't get
missed again.
12 years ago
Daniel Hokka Zakrisson
51216dcfae
Add tests for varReplace repr
12 years ago
Michael DeHaan
4ded8cb3b3
Change $FILE{} and $PIPE{} to $FILE() and $PIPE()
12 years ago
Daniel Hokka Zakrisson
cc948f339c
Allow including files through variables
...
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
12 years ago
Michael DeHaan
b8c4bb9e6e
Revert "Allow including files through variables"
...
This reverts commit bf47bb4753
.
Conflicts:
lib/ansible/utils.py
test/TestUtils.py
12 years ago
Michael DeHaan
b2af95e4a6
Change $FILE{} and $PIPE{} to $FILE() and $PIPE()
12 years ago
Daniel Hokka Zakrisson
bf47bb4753
Allow including files through variables
...
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
12 years ago
Dave Peticolas
08272dc25d
Remove unused imports.
12 years ago
Michael DeHaan
9e62fd42b5
update test utils code
13 years ago
Daniel Hokka Zakrisson
031c75e53a
Update tests to reflect new API
13 years ago
Daniel Hokka Zakrisson
24d73b0fe6
Add tests of iterative templating
13 years ago
Daniel Hokka Zakrisson
a05da2d312
Allow with_items to specify a variable
13 years ago
Matt Goodall
639763c138
Allow "=" in k-v values.
13 years ago
Jeroen Hoekx
dc60f2d844
Allow camelCase variables in varreplace.
13 years ago
Jeroen Hoekx
3cbc229990
Support list indexing in varReplace.
13 years ago
Jeroen Hoekx
74e21e6154
Fixup unicode varReplace templating.
...
The original patches should have conflicted?
53bde0bf51
vs efde61e537
13 years ago
Jeroen Hoekx
2bbc05185e
Make no_engine the default templating action.
13 years ago
Jeroen Hoekx
82144fd543
Support nested variables in varReplace.
13 years ago