Sha256: db0ab7919d00b4b18785da913d6ffab43f9180a35276e5ec6ea1a55cd455109a
Contents?: true
Size: 1.22 KB
Versions: 27
Compression:
Stored size: 1.22 KB
Contents
unless Fog.mocking? module Fog module Rackspace class Servers # Delete an existing server # # ==== Parameters # * id<~Integer> - Id of server to delete # def delete_server(server_id) request( :expects => 202, :method => 'DELETE', :path => "servers/#{server_id}" ) end end end end else module Fog module Rackspace class Servers def delete_server(server_id) response = Excon::Response.new if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id } if server['status'] == 'BUILD' response.status = 409 raise(Excon::Errors.status_error({:expects => 202}, response)) else Fog::Rackspace::Servers.data[:last_modified][:servers].delete(server_id) Fog::Rackspace::Servers.data[:servers].delete(server_id) response.status = 202 end else response.status = 404 raise(Excon::Errors.status_error({:expects => 202}, response)) end response end end end end end
Version data entries
27 entries across 27 versions & 1 rubygems