2011-03-09 20:03:15 -05:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 21:07:28 -04:00
|
|
|
require 'fog/virtual_box/models/compute/server'
|
2011-03-09 20:03:15 -05:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class VirtualBox
|
2011-03-09 20:03:15 -05:00
|
|
|
|
|
|
|
class Servers < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::VirtualBox::Server
|
2011-03-09 20:03:15 -05:00
|
|
|
|
|
|
|
def all
|
|
|
|
data = connection.machines.map do |machine|
|
|
|
|
{
|
|
|
|
:raw => machine
|
|
|
|
}
|
|
|
|
end
|
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def bootstrap(new_attributes = {})
|
|
|
|
raise 'Not Implemented'
|
|
|
|
# server = create(new_attributes)
|
|
|
|
# server.start
|
|
|
|
# server.wait_for { ready? }
|
|
|
|
# server.setup(:password => server.password)
|
|
|
|
# server
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(server_id)
|
|
|
|
machine = connection.find_machine(server_id)
|
|
|
|
new(:raw => machine)
|
|
|
|
rescue ::VirtualBox::Exceptions::ObjectNotFoundException
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|