mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Replace lists with a comma-separated join
This commit is contained in:
parent
13e8ef5f35
commit
dfee6e19ca
2 changed files with 15 additions and 0 deletions
|
@ -225,6 +225,19 @@ class TestUtils(unittest.TestCase):
|
|||
res = ansible.utils.varReplace(template, vars)
|
||||
assert res == 'bar'
|
||||
|
||||
def test_varReplace_list_join(self):
|
||||
vars = {
|
||||
'list': [
|
||||
'foo',
|
||||
'bar',
|
||||
'baz',
|
||||
],
|
||||
}
|
||||
|
||||
template = 'yum pkg=${list} state=installed'
|
||||
res = ansible.utils.varReplace(template, vars)
|
||||
assert res == 'yum pkg=foo,bar,baz state=installed'
|
||||
|
||||
def test_template_varReplace_iterated(self):
|
||||
template = 'hello $who'
|
||||
vars = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue