mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-16 06:24:54 +00:00
When operating on a unicode string in python 2.6, shlex.split returns
a result that does not work with the file constructor.
To reproduce this requires a task include that is templated (this is
because the templated string is a unicode result, whereas a non-
templated string is a non-unicode string)
[will@centos6.3] $ python
Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shlex
>>> shlex.split(u'abc')
['a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00']
[will@fedora17] $ python
Python 2.7.3 (default, Jul 24 2012, 10:05:38)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shlex
>>> shlex.split(u'abc')
['abc']
The proposed fix (coercing the include parameters to string before the
shlex.split) may not be ideal but it does fix the bug for my test case.
|
||
|---|---|---|
| .. | ||
| assemble.d | ||
| inventory_dir | ||
| test_playbook_vars | ||
| ansible.cfg | ||
| ansible_hosts | ||
| apt_key.gpg | ||
| CentOS.yml | ||
| common_vars.yml | ||
| complex_hosts | ||
| cron_test.yml | ||
| default_os.yml | ||
| hosts_list.yml | ||
| inventory_api.py | ||
| jinja2_overrides.tpl | ||
| large_range | ||
| lookup_plugins.yml | ||
| playbook-included.yml | ||
| playbook-includer.yml | ||
| playbook1.yml | ||
| results_list.yml | ||
| rocannon.txt | ||
| sample.j2 | ||
| simple_hosts | ||
| task-included.yml | ||
| task-includer.yml | ||
| template-basic | ||
| template-whitespace | ||
| TestConstants.py | ||
| TestFilters.py | ||
| TestInventory.py | ||
| TestPlayBook.py | ||
| TestRunner.py | ||
| TestUtils.py | ||
| world | ||