← Back to team overview

openstack team mailing list archive

Re: File injection support

 

On Wed, 30 May 2012, Fredric Morenius wrote:

> Hello Pádraig,
>
> I am also trying to get file injection to work in Essex, but have run into some issues, as stated here: https://answers.launchpad.net/nova/+question/198878
>
> The image I am launching is a simple bare container qcow2 image (CirrOS, this: https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img )

I generally think that "file injection" is significantly less preferable
to use of user-data or config-drive (an api/convention for providing
information to an instance).

cirros supports executing user-data starting with '#!', so you can
probably accomplish what you're after via passing data like this:

#!/bin/sh
cat > "/path/to/file" <<"EOF"
file contents here
EOF

wget http://some.url/my.tar | ( cd / && tar xvzf - )

base64 -d > /usr/bin/my-exe <<EOF
IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo=
EOF

chmod 755 /usr/bin/my-exe
#### end user data ###

You could also use 'shar' to do this.

References