yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #68507
[Bug 1723213] Re: vendor_raw stored to disk is broken if non-empty and not bytes
*** This bug is a duplicate of bug 1722992 ***
https://bugs.launchpad.net/bugs/1722992
** Changed in: cloud-init
Status: New => Confirmed
** Changed in: cloud-init
Importance: Undecided => Medium
** Bug watch added: bugs.centos.org/ #13931
https://bugs.centos.org/view.php?id=13931
** Also affects: cloud-init (CentOS) via
https://bugs.centos.org/view.php?id=13931
Importance: Unknown
Status: Unknown
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1723213
Title:
vendor_raw stored to disk is broken if non-empty and not bytes
Status in cloud-init:
Confirmed
Status in cloud-init package in CentOS:
Unknown
Bug description:
this was originally filed at
https://bugs.centos.org/view.php?id=13931
If a datasource has vendordata_raw attribute that ends up
with something other than None or bytes, then storing the vendordata_raw
will cause a stack trace like:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 513, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 281, in main_init
init.update()
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 357, in update
self._store_vendordata()
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 381, in _store_vendordata
util.write_file(self._get_ipath('vendordata_raw'), raw_vd, 0o600)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1755, in write_file
content = encode_text(content)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 154, in encode_text
return text.encode(encoding)
AttributeError: 'dict' object has no attribute 'encode'
Any datasource that uses convert_vendordata is possibly affected.
This is bad in that it fails, but not as bad as it could be. Cloud-init
itself never re-constitutes the blob on disk. Its only a convenience for
the user.
What we should do:
a.) always have vendordata_raw be bytes
b.) write them as bytes to the file
We can still allow the datasource to use something like 'convert_vendordata'
intelligently to get types other than bytes. We just have to have
the 'get_vendordata' function access a different attribute in the datasource.
ie:
- DataSource.vendordata_raw should always be the raw bytes as found.
- get_vendordata would then use some other attribuate 'vendordata_converted' (?) to take advantage of the datasource specific knowlege.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1723213/+subscriptions
References