Sha256: 2e258d5ef0b851c95f4f0ccd0fd48596804951474e96a91b2e351da6daad152b

Contents?: true

Size: 917 Bytes

Versions: 29

Compression:

Stored size: 917 Bytes

Contents

class Lono::Cfn
  class Delete
    include Lono::AwsServices
    include Lono::Utils::Sure

    def initialize(options={})
      @options = options
      @stack = options.delete(:stack)
    end

    def run
      message = "Deleting #{@stack} stack."
      if @options[:noop]
        puts "NOOP #{message}"
      else
        sure?("Are you sure you want to delete the #{@stack} stack?")

        if stack_exists?(@stack)
          cfn.delete_stack(stack_name: @stack)
          puts message
        else
          puts "#{@stack.inspect} stack does not exist".color(:red)
          return
        end
      end

      return unless @options[:wait]
      start_time = Time.now
      status.wait unless @options[:noop]
      took = Time.now - start_time
      puts "Time took for stack deletion: #{status.pretty_time(took).color(:green)}."
    end

    def status
      @status ||= Status.new(@stack)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/cfn/delete.rb
lono-7.5.1 lib/lono/cfn/delete.rb
lono-7.5.0 lib/lono/cfn/delete.rb
lono-7.4.11 lib/lono/cfn/delete.rb
lono-7.4.10 lib/lono/cfn/delete.rb
lono-7.4.9 lib/lono/cfn/delete.rb
lono-7.4.8 lib/lono/cfn/delete.rb
lono-7.4.7 lib/lono/cfn/delete.rb
lono-7.4.6 lib/lono/cfn/delete.rb
lono-7.4.5 lib/lono/cfn/delete.rb
lono-7.4.4 lib/lono/cfn/delete.rb
lono-7.4.3 lib/lono/cfn/delete.rb
lono-7.4.2 lib/lono/cfn/delete.rb
lono-7.4.1 lib/lono/cfn/delete.rb
lono-7.4.0 lib/lono/cfn/delete.rb
lono-7.3.2 lib/lono/cfn/delete.rb
lono-7.3.1 lib/lono/cfn/delete.rb
lono-7.3.0 lib/lono/cfn/delete.rb
lono-7.2.3 lib/lono/cfn/delete.rb
lono-7.2.2 lib/lono/cfn/delete.rb