Does the Rackspace Cloud Server API have APIs?

I am using the Ruby binding on the CloudServers API to deploy a cluster of machines.

The API includes the ability to "embed" files into the file system of a newly created machine using the "identity" field. However, I cannot upload files through the "identity" key. The machine was created correctly, but the file is missing when creating the server.

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

Could anyone do this work?

+5
source share
1 answer

I'm not sure which library you use, but I have successfully used identities through the Fog 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
+2
source

All Articles