1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #375 from dylanegan/force_detach

Public API for force_detach on Fog::Compute::AWS::Volume.
This commit is contained in:
Wesley Beary 2011-06-27 17:50:24 -07:00
commit 2edb89c512
2 changed files with 13 additions and 12 deletions

View file

@ -62,6 +62,10 @@ module Fog
connection.snapshots(:volume => self)
end
def force_detach
detach(true)
end
private
def attachmentSet=(new_attachment_set)
@ -81,25 +85,15 @@ module Fog
end
end
def detach
def detach(force = false)
@server = nil
self.server_id = nil
unless new_record?
connection.detach_volume(id)
connection.detach_volume(id, 'Force' => force)
reload
end
end
def force_detach
@server = nil
self.server_id = nil
unless new_record?
connection.detach_volume(id, 'Force' => true)
reload
end
end
end
end

View file

@ -17,6 +17,13 @@ Shindo.tests("Fog::Compute[:aws] | volume", ['aws']) do
@instance.server = nil
end
@instance.server = @server
@instance.wait_for { state == 'in-use' }
tests('#force_detach').succeeds do
@instance.force_detach
end
@instance.wait_for { ready? }
end