mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00: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:
@@ -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
|
||||
|
||||
#####################################
|
||||
|
||||
Reference in New Issue
Block a user