Class: Ufo::CLI::Destroy
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods included from Utils::Sure
Methods included from Utils::Pretty
#pretty_home, #pretty_path, #pretty_time
Methods included from Utils::Logging
Methods included from Ufo::Concerns
Methods included from Ufo::Concerns::Names
Methods included from AwsServices
#acm, #applicationautoscaling, #aws_options, #cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #find_stack, #ssm_client, #stack_resources, #status, #task_definition_arns
Constructor Details
This class inherits a constructor from Ufo::CLI::Base
Instance Method Details
#are_you_sure? ⇒ Boolean
27 28 29 |
# File 'lib/ufo/cli/destroy.rb', line 27 def are_you_sure? sure?("You are about to destroy the #{@stack_name.color(:green)} stack") end |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ufo/cli/destroy.rb', line 3 def run are_you_sure? stack = find_stack(@stack_name) unless stack puts "Stack #{@stack_name.color(:green)} does not exist." exit 1 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 stack #{@stack_name.color(:green)}" return unless @options[:wait] status.wait end |