Class: Ufo::Cancel
Instance Method Summary collapse
Methods inherited from Base
#full_service, #info, #initialize, #no_service_message, #switch_current
Methods included from Stack::Helper
#adjust_stack_name, #cfn, #find_stack, #status
Methods included from Util
#default_cluster, #display_params, #execute, #pretty_time, #settings, #task_definition_arns, #user_params
Methods included from AwsService
#cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb
Constructor Details
This class inherits a constructor from Ufo::Base
Instance Method Details
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ufo/cancel.rb', line 3 def run stack = find_stack(@stack_name) unless stack puts "No #{@service} service to cancel." puts "No #{@stack_name} stack to cancel. Exiting" exit end puts "Canceling updates to #{@stack_name}." if stack.stack_status == "CREATE_IN_PROGRESS" cloudformation.delete_stack(stack_name: @stack_name) puts "Canceling stack creation." elsif stack.stack_status == "UPDATE_IN_PROGRESS" cloudformation.cancel_update_stack(stack_name: @stack_name) puts "Canceling stack update." else puts "The stack is not in a state to that is cancelable: #{stack.stack_status}" end end |