Sha256: 3810e7b1b681f813aae5177b09d0e15241c9472c4edb0009960338b01154046b

Contents?: true

Size: 1.02 KB

Versions: 14

Compression:

Stored size: 1.02 KB

Contents

class Ufo::CLI
  class Destroy < Base
    include Ufo::Hooks::Concern

    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

    def are_you_sure?
      sure?("You are about to destroy the #{@stack_name.color(:green)} stack")
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ufo-6.3.13 lib/ufo/cli/destroy.rb
ufo-6.3.12 lib/ufo/cli/destroy.rb
ufo-6.3.11 lib/ufo/cli/destroy.rb
ufo-6.3.10 lib/ufo/cli/destroy.rb
ufo-6.3.9 lib/ufo/cli/destroy.rb
ufo-6.3.8 lib/ufo/cli/destroy.rb
ufo-6.3.7 lib/ufo/cli/destroy.rb
ufo-6.3.6 lib/ufo/cli/destroy.rb
ufo-6.3.5 lib/ufo/cli/destroy.rb
ufo-6.3.4 lib/ufo/cli/destroy.rb
ufo-6.3.3 lib/ufo/cli/destroy.rb
ufo-6.3.2 lib/ufo/cli/destroy.rb
ufo-6.3.1 lib/ufo/cli/destroy.rb
ufo-6.3.0 lib/ufo/cli/destroy.rb