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_delete.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

32 lines
762 B
Ruby

module Fog
module Voxel
class Compute
class Real
def voxcloud_delete( device_id )
options = { :device_id => device_id }
data = request("voxel.voxcloud.delete", options )
unless data['stat'] == 'ok'
raise "Error from Voxel hAPI: #{data['err']['msg']}"
end
true
end
end
class Mock
def voxcloud_delete( device_id )
device = @data[:servers].select { |d| d[:id] == device_id }
if device.empty?
raise Fog::Voxel::Compute::NotFound
else
@data[:servers] = @data[:servers].select { |d| d[:id] != device_id }
@data[:statuses].delete(device_id)
true
end
end
end
end
end
end