Class: Ufo::Destroy
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, #find_stack, #status
Methods included from Settings
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
#are_you_sure? ⇒ Boolean
33 34 35 36 37 38 39 |
# File 'lib/ufo/destroy.rb', line 33 def are_you_sure? return true if @options[:sure] puts "You are about to destroy the #{@stack_name.color(:green)} stack. This contains the #{@service.color(:green)} service on the #{@cluster.color(:green)} cluster." print "Are you sure you want to do this? (y/N) " answer = $stdin.gets.strip answer =~ /^y/ end |
#bye ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ufo/destroy.rb', line 3 def bye unless are_you_sure? puts "Phew, that was close" return end stack = find_stack(@stack_name) unless stack puts "Stack #{@stack_name.color(:green)} does not exist." exit end if stack.stack_status =~ /_IN_PROGRESS$/ puts "Cannot destroy service #{@service.color(:green)}" puts "Cannot delete stack #{@stack_name.color(:green)} in this state: #{stack.stack_status.color(:green)}" puts "If the stack is taking a long time, you can cancel the current operation with:" puts " ufo cancel #{@service}" return end cloudformation.delete_stack(stack_name: @stack_name) puts "Deleting CloudFormation stack with ECS resources: #{@stack_name}." return unless @options[:wait] start_time = Time.now status.wait took = Time.now - start_time puts "Time took for deletion: #{status.pretty_time(took).color(:green)}." end |