mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 04:11:25 -07:00
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.
This commit is contained in:
parent
42daffdb38
commit
a79373f6b2
5 changed files with 21 additions and 30 deletions
|
@ -324,19 +324,19 @@ class TestUtils(unittest.TestCase):
|
|||
}
|
||||
|
||||
template = '${data.var}'
|
||||
res = ansible.utils.template_ds(None, template, vars)
|
||||
res = ansible.utils.template(None, template, vars)
|
||||
assert sorted(res) == sorted(vars['data']['var'])
|
||||
|
||||
template = '${data.types}'
|
||||
res = ansible.utils.template_ds(None, template, vars)
|
||||
res = ansible.utils.template(None, template, vars)
|
||||
assert sorted(res) == sorted(vars['data']['types'])
|
||||
|
||||
template = '${data.alphas}'
|
||||
res = ansible.utils.template_ds(None, template, vars)
|
||||
res = ansible.utils.template(None, template, vars)
|
||||
assert sorted(res) == sorted(vars['alphas'])
|
||||
|
||||
template = '${data.nonexisting}'
|
||||
res = ansible.utils.template_ds(None, template, vars)
|
||||
res = ansible.utils.template(None, template, vars)
|
||||
assert res == template
|
||||
|
||||
#####################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue