Sha256: c98505a59e1fd83c08ce742c090ebb056bdb53fbf7cd8ef83d07c1c0712676ad

Contents?: true

Size: 896 Bytes

Versions: 6

Compression:

Stored size: 896 Bytes

Contents

class Ufo::CLI
  class Destroy < Base
    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

      cfn.delete_stack(stack_name: @stack_name)
      puts "Deleting stack #{@stack_name.color(:green)}"

      return unless @options[:wait]
      status.wait
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ufo-6.2.5 lib/ufo/cli/destroy.rb
ufo-6.2.4 lib/ufo/cli/destroy.rb
ufo-6.2.3 lib/ufo/cli/destroy.rb
ufo-6.2.2 lib/ufo/cli/destroy.rb
ufo-6.2.1 lib/ufo/cli/destroy.rb
ufo-6.2.0 lib/ufo/cli/destroy.rb