cloudbase init encoding for write_files

asked 2016-04-14 15:20:56 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I would gladly provide code to fix this issue - do you accept PRs? Thought about moving to github for issue tracking,etc? :)

Hi,

I am having issues with cloudbase init where there does not seem to be a method/workflow of delivering txt to a VM. It appears that cloud-config in Userdata should do this, but I am running into issues with encoding. The documentation suggests that encoding is required, however the actual code says that it is optional.

Link to code and snip below:

https://github.com/openstack/cloudbas...

"""Plugin for writing files on the filesystem. It can process either a list of files or only one file, where the file is represented by a dictionary, which can contain the following keys: path: The absolute path to the location on the filesystem where the file should be written. content: The content that should be placed in the file. owner: The user account and group that should be given ownership of the file. permissions: The octal permissions set that should be given for this file. encoding: An optional encoding specification for the file. The only required keys in this dictionary are path and content. """

If you do not specify encoding it will write file however you will get an error:

ERROR cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins.write_files [-] Unknown encoding, doing nothing.

It seems like a very standard workflow to pass txt via userdata. There are a ton of examples on the internet. The non base cloudinit handles it as expected. http://bazaar.launchpad.net/~cloud-in...writefiles.py

Would you agree this is a bug in cloudbase init? Is there a suggested way of passing txt via userdata.

Thanks,

Cliff

edit retag flag offensive close merge delete

Comments

Hi Cliff, for issues and patches we use the same tools used by the OpenStack community: Issues: https://bugs.launchpad.net/cloudbase-init, contributions (Gerrit): https://review.openstack.org

alexpilotti gravatar imagealexpilotti ( 2016-04-20 15:45:18 +0200 )edit