1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/clodo/models/compute/servers.rb

37 lines
757 B
Ruby
Raw Normal View History

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