Commit graph

30 commits

Author SHA1 Message Date
Daniel Hokka Zakrisson
47082a9171 Add $LOOKUP(<lookup plugin>,<data>) as a templating option
Also moves file and pipe to lookup_plugins.
2012-11-07 23:17:29 +01:00
Daniel Hokka Zakrisson
56314f7225 Add test case for non-existing variable in varReplaceWithItems 2012-11-01 19:24:53 +01:00
Daniel Hokka Zakrisson
efe83daf19 Fix ${var.$other_var} and add test cases for it 2012-10-30 13:05:45 +01:00
Daniel Hokka Zakrisson
c9c5fc1456 Merge varFind and varLookup 2012-10-21 20:32:02 +02:00
Michael DeHaan
6fa1a49037 Fix the basic templating system such that when the template ends in '$', life continues as normal. 2012-10-20 10:57:52 -04:00
Michael DeHaan
0837a29e51 Only expand lists in templating inside of module action lines, to avoid breaking usage with with_items and "in" statements, etc 2012-10-17 19:35:12 -04:00
Daniel Hokka Zakrisson
695b4bcb46 Allow non-string types in with_items variables 2012-10-01 17:07:51 +02:00
Michael DeHaan
22f3aef4dc remove test for private function that is no longer present 2012-09-30 20:49:16 -04:00
Daniel Hokka Zakrisson
dfee6e19ca Replace lists with a comma-separated join 2012-09-30 11:41:44 +02:00
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.
2012-09-28 13:58:23 +02:00
Michael DeHaan
06cfc52afd fix tests and change nosetests flags so asserts show what comparisons failed 2012-09-27 22:12:15 -04:00
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.
2012-09-28 01:03:34 +02:00
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.
2012-09-27 18:36:52 +02:00
Daniel Hokka Zakrisson
51216dcfae Add tests for varReplace repr 2012-09-25 20:14:58 -04:00
Michael DeHaan
4ded8cb3b3 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 2012-09-19 17:58:16 +02:00
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"
2012-09-19 17:57:17 +02:00
Michael DeHaan
b8c4bb9e6e Revert "Allow including files through variables"
This reverts commit bf47bb4753.

Conflicts:

	lib/ansible/utils.py
	test/TestUtils.py
2012-09-19 10:31:23 -04:00
Michael DeHaan
b2af95e4a6 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 2012-09-18 21:34:55 -04:00
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"
2012-09-17 16:03:59 +02:00
Dave Peticolas
08272dc25d Remove unused imports. 2012-08-09 21:35:22 -07:00
Michael DeHaan
9e62fd42b5 update test utils code 2012-07-16 20:28:32 -04:00
Daniel Hokka Zakrisson
031c75e53a Update tests to reflect new API 2012-06-18 00:13:12 +02:00
Daniel Hokka Zakrisson
24d73b0fe6 Add tests of iterative templating 2012-06-16 13:13:01 +02:00
Daniel Hokka Zakrisson
a05da2d312 Allow with_items to specify a variable 2012-06-09 21:59:22 +02:00
Matt Goodall
639763c138 Allow "=" in k-v values. 2012-05-23 00:58:05 +01:00
Jeroen Hoekx
dc60f2d844 Allow camelCase variables in varreplace. 2012-05-11 14:14:53 +02:00
Jeroen Hoekx
3cbc229990 Support list indexing in varReplace. 2012-05-10 19:25:28 +02:00
Jeroen Hoekx
74e21e6154 Fixup unicode varReplace templating.
The original patches should have conflicted?
53bde0bf51 vs efde61e537
2012-05-10 10:11:14 +02:00
Jeroen Hoekx
2bbc05185e Make no_engine the default templating action. 2012-05-09 16:15:43 +02:00
Jeroen Hoekx
82144fd543 Support nested variables in varReplace. 2012-05-09 16:15:43 +02:00