Class: Ufo::CLI::Destroy
- Includes:
- Hooks::Concern
- Defined in:
- lib/ufo/cli/destroy.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Hooks::Concern
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, #cfn, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #s3, #ssm_client, #waf_client
Methods included from AwsServices::Concerns
#find_stack, #find_stack_resources, #stack_resources, #status, #task_definition_arns
Constructor Details
This class inherits a constructor from Ufo::CLI::Base
Instance Method Details
#are_you_sure? ⇒ Boolean
30 31 32 |
# File 'lib/ufo/cli/destroy.rb', line 30 def are_you_sure? sure?("You are about to destroy the #{@stack_name.color(:green)} stack") end |
#run ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ufo/cli/destroy.rb', line 5 def run are_you_sure? stack = find_stack(@stack_name) unless stack logger.info "Stack #{@stack_name.color(:green)} does not exist." exit 1 end if stack.stack_status =~ /_IN_PROGRESS$/ logger.info "Cannot destroy service #{@service.color(:green)}" logger.info "Cannot delete stack #{@stack_name.color(:green)} in this state: #{stack.stack_status.color(:green)}" logger.info "If the stack is taking a long time, you can cancel the current operation with:" logger.info " ufo cancel #{@service}" return end run_hooks(name: "destroy", file: "ufo.rb") do cfn.delete_stack(stack_name: @stack_name) logger.info "Deleting stack #{@stack_name.color(:green)}" return unless @options[:wait] status.wait end end |