mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #2620 from willthames/shlex_split_bug
Test case and fix for shlex.split unicode bug
This commit is contained in:
commit
586ee923a6
4 changed files with 33 additions and 1 deletions
|
@ -194,7 +194,7 @@ class Play(object):
|
||||||
task_vars['_original_file'] = original_file
|
task_vars['_original_file'] = original_file
|
||||||
|
|
||||||
if 'include' in x:
|
if 'include' in x:
|
||||||
tokens = shlex.split(x['include'])
|
tokens = shlex.split(str(x['include']))
|
||||||
items = ['']
|
items = ['']
|
||||||
included_additional_conditions = list(additional_conditions)
|
included_additional_conditions = list(additional_conditions)
|
||||||
for k in x:
|
for k in x:
|
||||||
|
|
|
@ -211,6 +211,27 @@ class TestPlaybook(unittest.TestCase):
|
||||||
|
|
||||||
assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
|
assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
|
||||||
|
|
||||||
|
def test_task_includes(self):
|
||||||
|
pb = os.path.join(self.test_dir, 'task-includer.yml')
|
||||||
|
actual = self._run(pb)
|
||||||
|
|
||||||
|
# if different, this will output to screen
|
||||||
|
print "**ACTUAL**"
|
||||||
|
print utils.jsonify(actual, format=True)
|
||||||
|
expected = {
|
||||||
|
"localhost": {
|
||||||
|
"changed": 0,
|
||||||
|
"failures": 0,
|
||||||
|
"ok": 1,
|
||||||
|
"skipped": 0,
|
||||||
|
"unreachable": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "**EXPECTED**"
|
||||||
|
print utils.jsonify(expected, format=True)
|
||||||
|
|
||||||
|
assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
|
||||||
|
|
||||||
def test_playbook_vars(self):
|
def test_playbook_vars(self):
|
||||||
test_callbacks = TestCallbacks()
|
test_callbacks = TestCallbacks()
|
||||||
playbook = ansible.playbook.PlayBook(
|
playbook = ansible.playbook.PlayBook(
|
||||||
|
|
2
test/task-included.yml
Normal file
2
test/task-included.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
- action: debug msg="$internal"
|
9
test/task-includer.yml
Normal file
9
test/task-includer.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
connection: local
|
||||||
|
gather_facts: no
|
||||||
|
vars:
|
||||||
|
- internal: xyz
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- include: task-included.yml internal=$internal
|
Loading…
Reference in a new issue