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

Add force stop functionality to AWS Instance

AWS allows you to add a force option to the stop request. This performs
the equivalent of a power off, rather thank asking the OS to shutdown.
This commit is contained in:
John Ferlito 2011-08-08 17:29:16 +10:00
parent 4847886472
commit 5b3b1888ad
2 changed files with 4 additions and 3 deletions

View file

@ -222,9 +222,9 @@ module Fog
true
end
def stop
def stop(force = false)
requires :id
connection.stop_instances(id)
connection.stop_instances(id, force)
true
end

View file

@ -17,8 +17,9 @@ module Fog
# * TODO: fill in the blanks
#
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html]
def stop_instances(instance_id)
def stop_instances(instance_id, force = false)
params = Fog::AWS.indexed_param('InstanceId', instance_id)
params.merge!('Force' => 'true') if force
request({
'Action' => 'StopInstances',
:idempotent => true,