cloud-config.service is failing with a unicodedecodeerror
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Expired
|
Undecided
|
Unassigned |
Bug Description
With 0.7.8 on a CentOS 7 environment, I am seeing cloud-init fail (when called from cloud-config.
Traceback (most recent call last):
File "/usr/lib/
freq=freq)
File "/usr/lib/
return self._runners.
File "/usr/lib/
results = functor(*args)
File "/usr/lib/
cloud.
File "/usr/lib/
rhel_
File "/usr/lib/
(exists, contents) = read_sysconfig_
File "/usr/lib/
return (exists, SysConf(contents))
File "/usr/lib/
write_
File "/usr/lib/
self.
File "/usr/lib/
infile = self._handle_
File "/usr/lib/
if not line.startswith
UnicodeDecode
This looks like it is ultimately a bug with the 'configobj' module (CentOS 7 has 4.7.2). The following reproduces the failure:
import configobj
import cloudinit.util
contents = cloudinit.
cfg = configobj.
This only happens when 'contents' is a unicode string. If we call .encode() on the string first, everything works correctly:
import configobj
import cloudinit.util
contents = cloudinit.
cfg = configobj.
Hi! Thanks for taking the time for filing a bug.
There has been significant work on the CentOS/RHEL support in the newest version of cloud-init. If you are willing and able, it would be great if you could try the latest version from our COPR repo:
https:/ /copr.fedorainf racloud. org/coprs/ g/cloud- init/cloud- init/