2011-02-09 17:03:02 -05:00
|
|
|
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 )
|
2011-02-20 19:10:59 -05:00
|
|
|
device = @data[:servers].select { |d| d[:id] == device_id }
|
2011-02-09 17:03:02 -05:00
|
|
|
|
2011-02-20 14:39:37 -05:00
|
|
|
if device.empty?
|
|
|
|
raise Fog::Voxel::Compute::NotFound
|
|
|
|
else
|
2011-02-20 19:10:59 -05:00
|
|
|
@data[:servers] = @data[:servers].select { |d| d[:id] != device_id }
|
2011-02-20 14:39:37 -05:00
|
|
|
@data[:statuses].delete(device_id)
|
|
|
|
true
|
|
|
|
end
|
2011-02-09 17:03:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|