Age | Commit message (Collapse) | Author |
|
Thanks: Garrett Holmstrom
LP: #883367
|
|
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
|
|
base64 encode will grow with the size of the url, possibly resulting
in silly-long filenames. md5sum will keep it to a constant length.
|
|
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.
|
|
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.
|
|
|
|
|
|
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
|
|
|
|
|
|
LP: #627439
|
|
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
|
|
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.
|
|
|
|
|
|
|