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/compute/requests/voxel/voxcloud_create.rb
James W. Brinkerhoff d37397becc fix to allow voxcloud_create call with :password and :name vs :admin_password and :hostname
bugfix in voxcloud_delete mock, devices vs servers
2011-02-23 15:38:47 -08:00

40 lines
1.1 KiB
Ruby

module Fog
module Voxel
class Compute
class Real
def voxcloud_create( options )
options[:hostname] = options[:name]
options.delete(:name)
if options.has_key?(:password)
options[:admin_password] = options[:password]
options.delete(:password)
end
data = request("voxel.voxcloud.create", options)
unless data['stat'] == 'ok'
raise "Error from Voxel hAPI: #{data['err']['msg']}"
end
devices_list(data['device']['id'])
end
end
class Mock
def voxcloud_create( options )
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)
end
end
end
end
end