2011-09-30 17:45:09 -04:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/clodo/models/compute/server'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Clodo
|
|
|
|
|
|
|
|
class Servers < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Compute::Clodo::Server
|
|
|
|
|
|
|
|
def all
|
2012-12-22 18:29:06 -05:00
|
|
|
data = service.list_servers_detail.body['servers']
|
2011-09-30 17:45:09 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def bootstrap(new_attributes = {})
|
|
|
|
server = create(new_attributes)
|
|
|
|
server.wait_for { ready? }
|
|
|
|
server.setup(:password => server.password)
|
|
|
|
server
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(server_id)
|
2012-12-22 18:29:06 -05:00
|
|
|
if server = service.get_server_details(server_id).body['server']
|
2011-09-30 17:45:09 -04:00
|
|
|
new(server)
|
|
|
|
end
|
|
|
|
rescue Fog::Compute::Clodo::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|