summaryrefslogtreecommitdiff
path: root/cloudinit/UserDataHandler.py
AgeCommit message (Collapse)Author
2012-06-071. Adding some new helper files that split off file inclusion, templating, ↵Joshua Harlow
importing, constant usage. 1. Move all datasources to a new sources directory 1. Rename some files to be more consistent with python file/module naming.
2012-03-12Restrict warning to userdata without MIME wrapping only while still ignoring ↵Martin Packman
most types
2012-01-30support empty lines in '#include' files (LP: #923043)Scott Moser
LP: #923043
2012-01-18Add HP to Copyright, and Juerg Haefliger Authors.Scott Moser
This copyright change reflects previous changes that Juerg made for pylint and pep8 cleanups. From: Juerg Haefliger <juerg.haefliger@hp.com> Date: Mon, 16 Jan 2012 10:45:12 +0100
2012-01-17remove occurences of pylint W0621 (Redefining name xyz from outer scope)Scott Moser
2012-01-17[PATCH] PEP8 coding style fixes.Scott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com> This pulls in the named patch for LP: #914739 with a few other changes.
2012-01-17[PATCH 4/4] Fix pylint conventions C0301 (line too long)Scott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com>
2012-01-17[PATCH 3/4] Fix pylint conventions C0324 (comma not followed by a space)Scott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com>
2012-01-17[PATCH 2/4] Fix pylint conventions C0322 (operator not preceded by a space)Scott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com>
2012-01-17[PATCH 1/4] Fix pylint conventions C0321 (more than one statement on a ↵Scott Moser
single line) From: Juerg Haefliger <juerg.haefliger@hp.com>
2012-01-12[PATCH 10/13] Fix pylint warnings W0102 (dangerous default value asScott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com> argument)
2012-01-12[PATCH 07/13] Fix pylint warnings W0622 (redefining built-in 'xyz')Scott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com>
2012-01-12[PATCH 06/13] Fix pylint warnings W0612 (unused variable)Scott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com>
2012-01-12[PATCH 04/13] Fix pylint warnings W0611 (unused import)Scott Moser
From: Juerg Haefliger <juerg.haefliger@hp.com>
2011-12-22fix issue with multiple content-typesScott Moser
2011-12-22fix issue with part-handlers and base64 encoding (LP: #874342)Scott Moser
Previously, * if content came into cloud-init for processing came in via a multipart mime file, and was already base64 encoded, it would get base64 encoded again before being handed to a part-handler. * if it came in via a '#include'd file then it would not be encoded at all. This drops the internal 'parts' array, that was just converted to and then from. Instead, we keep MIME format throughout and keep headers along the way. That means that a message that comes in with 'Content-Transfer-Encoding' set to 'base64' will be decoded before being handed to a part-handler. It also reduces the chance of failure due to content appearing to be an actual email. Previously if content contained colon separated fields, it might be read as headers (email.message_from_string(open("/etc/passwd","r")) would come back as all headers, no payload) The weak point right now is that '#include'd data cannot have mime types associated with it (unless it is a mime formatted content). I had hoped to read user headers and possibly set 'Content-Type' from that.
2011-10-31use hashlib rather than md5 module to avoid deprecation warning.Scott Moser
Thanks: Garrett Holmstrom LP: #883367
2011-08-02This fixes LP: #819507, to make consume_userdata run 'always'Scott Moser
consume_userdata should really run always, rather than once per instance. The documentation says that boothooks were on their own for per-instance but since this routine was only being called once, they would only get called once. This modifies the behavior to be: user_script: per_always cloud_config : per_always upstart_job : per_instance cloud_boothook: per_always In order to not break part handlers that are existing, and expect to only be called once per instance, this adds a 'handler_version' item in a handler that can indicate the version (currently 1 or 2). If it is 2, then the hander will be passed the frequency (per-instance or per-always) that this is being run. That way the handler can differenciate between them. This also makes 'bootcmd' run every boot. That should be changable in cloud-config though, so users who dont like the behavior can modify it. LP: #819507
2011-07-26use md5sum as the unique identifier rather than base64Scott Moser
base64 encode will grow with the size of the url, possibly resulting in silly-long filenames. md5sum will keep it to a constant length.
2011-07-26include-once: fixups found in testingScott Moser
at this point, the following user-data file in /var/lib/cloud/seed/nocloud-net/user-data will do what you would expect: $ cat > /var/lib/cloud/seed/nocloud-net/user-data <<EOF #include-once http://169.254.169.254/2011-01-01/user-data EOF $ python -c \ 'import boto.utils, pprint; pprint.pprint(boto.utils.get_instance_metadata())' | sudo tee /var/lib/cloud/seed/nocloud-net/meta-data Then, $ sudo sh -c 'for i in /var/lib/cloud/*; do [ ${i##*/} = "seed" ] && continue; rm -Rf "$i"; done' $ sudo reboot You will then find a file in /var/lib/cloud/instance/data/urlcache/ that has the contents of user-data from the metadata service. It will not be downloaded again as long as that file is present.
2011-07-26make 'include-once' really "download source once per-instance"Scott Moser
Marc's implementation would only ever process the include-once urls a single time. This changes that to process them every time, with the second time coming from a file on disk rather than the url. You can then do expiring or one time use URLs in the include-once and have all function of if the content was there every time. The cached file is readable by root-only.
2011-07-25Added new feature include-onceMarc Cluet
2011-03-30remove debug printout in cloudinit/UserDataHandler.pyScott Moser
2011-01-19add cloud-config-archive input type.Scott Moser
cloud-config-archive is a yaml formated document where the top level should contain an array. Each entry in the array can be one of - dict { 'filename' : 'value' , 'content' : 'value', 'type' : 'value' } filename and type may not be present - scalar(content) if filename and type are not present, they are attempted to be guessed. LP: #641504
2011-01-19do not use 'str' as a variable nameScott Moser
2010-09-08remove broken (syntax) try/catch in UserDataHandler.pyScott Moser
2010-08-31get '##' comment lines through to /etc/apt/sources.list (LP: #627439)Scott Moser
LP: #627439
2010-07-01resort to "starts with" to find mime type only on plain/text (LP: #600799)Scott Moser
The starts-with determination of mime type was overriding an explicit setting in the mime-type. This was evident when the mime type specified boothook, but the content began with '#!'. In that case, the content would run as a user script rather than boothook. LP: #600799
2010-06-18add 'cloud-boothook' typeScott Moser
if user data is of type text/cloud-boothook, or begins with #cloud-boothook, then assume it to be code to be executed. Boothooks are a very simple format. Basically, its a one line header ('#cloud-config\n') and then executable payload. The executable payload is written to a file, then that file is executed at the time it is read. The file is left in /var/lib/cloud/data/boothooks There is no "first-time-only" protection. If running only once is desired, the boothook must handle that itself.
2010-06-15add vi modelines to python filesScott Moser
2010-02-04add copyright informationScott Moser
2010-02-03globally remove ec2init and rename to cloudinitScott Moser