Sha256: 84b3476ab0e2432cb888990d2d73b3fa90da354045da42e9c0b6c087e7fb1be1

Contents?: true

Size: 1006 Bytes

Versions: 28

Compression:

Stored size: 1006 Bytes

Contents

class Lono::Cfn
  class Cancel
    include Lono::AwsServices
    include Util

    def initialize(stack_name, options={})
      @stack_name = switch_current(stack_name)
      @options = options
    end

    def run
      stack = find_stack(@stack_name)
      unless stack
        puts "The '#{@stack_name}' stack does not exist. Unable to cancel"
        exit 1
      end

      puts "Canceling updates to #{@stack_name}."
      puts "Current stack status: #{stack.stack_status}"
      if stack.stack_status == "CREATE_IN_PROGRESS"
        cfn.delete_stack(stack_name: @stack_name)
        puts "Canceling stack creation."
      elsif stack.stack_status == "UPDATE_IN_PROGRESS"
        cfn.cancel_update_stack(stack_name: @stack_name)
        puts "Canceling stack update."
        status.wait if @options[:wait]
      else
        puts "The stack is not in a state to that is cancelable: #{stack.stack_status}"
      end
    end

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

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
lono-6.1.11 lib/lono/cfn/cancel.rb
lono-6.1.10 lib/lono/cfn/cancel.rb
lono-6.1.9 lib/lono/cfn/cancel.rb
lono-6.1.8 lib/lono/cfn/cancel.rb
lono-6.1.7 lib/lono/cfn/cancel.rb
lono-6.1.6 lib/lono/cfn/cancel.rb
lono-6.1.5 lib/lono/cfn/cancel.rb
lono-6.1.4 lib/lono/cfn/cancel.rb
lono-6.1.3 lib/lono/cfn/cancel.rb
lono-6.1.2 lib/lono/cfn/cancel.rb
lono-6.1.1 lib/lono/cfn/cancel.rb
lono-6.1.0 lib/lono/cfn/cancel.rb
lono-6.0.1 lib/lono/cfn/cancel.rb
lono-6.0.0 lib/lono/cfn/cancel.rb
lono-5.3.4 lib/lono/cfn/cancel.rb
lono-5.3.3 lib/lono/cfn/cancel.rb
lono-5.3.2 lib/lono/cfn/cancel.rb
lono-5.3.1 lib/lono/cfn/cancel.rb
lono-5.3.0 lib/lono/cfn/cancel.rb
lono-5.2.8 lib/lono/cfn/cancel.rb