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.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
assemble.d | Loading commit data... | |
inventory_dir | Loading commit data... | |
test_playbook_vars | Loading commit data... | |
CentOS.yml | Loading commit data... | |
TestConstants.py | Loading commit data... | |
TestFilters.py | Loading commit data... | |
TestInventory.py | Loading commit data... | |
TestPlayBook.py | Loading commit data... | |
TestRunner.py | Loading commit data... | |
TestUtils.py | Loading commit data... | |
ansible.cfg | Loading commit data... | |
ansible_hosts | Loading commit data... | |
apt_key.gpg | Loading commit data... | |
common_vars.yml | Loading commit data... | |
complex_hosts | Loading commit data... | |
cron_test.yml | Loading commit data... | |
default_os.yml | Loading commit data... | |
hosts_list.yml | Loading commit data... | |
inventory_api.py | Loading commit data... | |
jinja2_overrides.tpl | Loading commit data... | |
large_range | Loading commit data... | |
lookup_plugins.yml | Loading commit data... | |
playbook-included.yml | Loading commit data... | |
playbook-includer.yml | Loading commit data... | |
playbook1.yml | Loading commit data... | |
results_list.yml | Loading commit data... | |
rocannon.txt | Loading commit data... | |
sample.j2 | Loading commit data... | |
simple_hosts | Loading commit data... | |
task-included.yml | Loading commit data... | |
task-includer.yml | Loading commit data... | |
template-basic | Loading commit data... | |
template-whitespace | Loading commit data... | |
world | Loading commit data... |