write_files errors out on non ascii content
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Scott Moser |
Bug Description
When trying to add content in the write_files an error is thrown:
2015-08-23 10:37:54,678 - util.py[WARNING]: Running write_files (<module 'cloudinit.
The cloud-config file is attached.
When searching for the root cause, found to be an error raised in line 95 of cloudinit/
"""
def extract_
result = str(contents)
for t in extraction_types:
"""
The conversion from unicode to string throws an exception. I tested this by using a plain script:
"""
#!/bin/python
import yaml
f=open(
conf = yaml.load(f)
print "Testing write_files bug ... "
for c in conf['write_
print "Content to string: ",str(c['content'])
"""
With this output:
"""
Testing write_files bug ...
Content to string:
Traceback (most recent call last):
File "utils/
print "Content to string: ",str(c['content'])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 1087: ordinal not in range(128)
"""
Line 40 of the configuration file, is the offending one, it's a comment.
This is fixed in trunk in revno 1199 (fixed with the fix for bug 1565638)