I'm using the Ruby binding to the CloudServers API to spin up a cluster of machines.
The API includes the ability to "inject" files into the filesystem of the newly created machine, using a field called "personality". However, I'm not able to upload files via the "personality" key. The machine is created properly, but the file is not present when the server is created.
Here's a test script that demonstrates this:
#!/usr/bin/env ruby
require 'rubygems'
require 'cloudservers'
cs = CloudServers::Connection.new(:username=>"user",:api_key=>"key")
begin
server = cs.create_server(:flavorId=>1,
:name=>"personality-test",
:imageId=>7888402,
:personality=>{"/tmp/foo"=>"/tmp/foo" })
rescue
print "Failed to create server ", $!, "\n"
end
Has anyone been able to make this work?
I'm not sure which library you're using, but I've successfully used personalities via Fog's Rackspace Cloud backend.
server = Fog::Compute.new(:provider => 'Rackspace',
:rackspace_username => config[:rackspace_api_username],
:rackspace_api_key => config[:rackspace_api_key])
server.flavor_id = sizes[args[:size]]
server.image_id = 49 # Ubuntu 10.04
server.name = args[:fqdn]
server.personality = [
{
'path' => '/etc/install-chef',
'contents' => File.read("install-chef.sh")
}
]
server.save
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With