2011-01-19 19:17:23 -05:00
|
|
|
module Fog
|
|
|
|
module Voxel
|
|
|
|
class Compute
|
|
|
|
class Real
|
|
|
|
def voxcloud_create( options )
|
2011-02-20 19:10:59 -05:00
|
|
|
options[:hostname] = options[:name]
|
|
|
|
options.delete(:name)
|
|
|
|
|
|
|
|
if options.has_key?(:password)
|
|
|
|
options[:admin_password] = options[:password]
|
|
|
|
options.delete(:password)
|
|
|
|
end
|
|
|
|
|
2011-01-19 19:17:23 -05:00
|
|
|
data = request("voxel.voxcloud.create", options)
|
|
|
|
|
|
|
|
unless data['stat'] == 'ok'
|
2011-02-09 11:04:31 -05:00
|
|
|
raise "Error from Voxel hAPI: #{data['err']['msg']}"
|
2011-01-19 19:17:23 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
devices_list(data['device']['id'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
2011-01-20 13:52:02 -05:00
|
|
|
def voxcloud_create( options )
|
2011-02-20 14:39:37 -05:00
|
|
|
device_id = Fog::Mock.random_numbers(7).to_i
|
|
|
|
@data[:last_modified][:servers][device_id] = Time.now
|
|
|
|
@data[:last_modified][:statuses][device_id] = Time.now
|
|
|
|
@data[:statuses][device_id] = "QUEUED"
|
|
|
|
@data[:servers].push( options.merge( {
|
|
|
|
:password => "CHANGEME",
|
|
|
|
:id => device_id,
|
|
|
|
:addresses => { :private => '0.0.0.0', :public => '0.0.0.0' }
|
|
|
|
} ) )
|
|
|
|
devices_list(device_id)
|
2011-01-19 19:17:23 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|