Class: Lono::Cfn::Rollback

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
AwsServices
Defined in:
lib/lono/cfn/rollback.rb

Instance Method Summary collapse

Methods included from AwsServices

#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts

Methods included from AwsServices::Util

#find_stack, #rollback_complete?, #stack_exists?, #testing_update?

Constructor Details

#initialize(stack_name) ⇒ Rollback

Returns a new instance of Rollback.



6
7
8
# File 'lib/lono/cfn/rollback.rb', line 6

def initialize(stack_name)
  @stack_name = stack_name
end

Instance Method Details

#delete_stackObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/lono/cfn/rollback.rb', line 10

def delete_stack
  stack = find_stack(@stack_name)
  if stack && rollback_complete?(stack)
    puts "Existing stack in ROLLBACK_COMPLETE state. Deleting stack before continuing."
    cfn.delete_stack(stack_name: @stack_name)
    status.wait
    status.reset
    true
  end
end

#statusObject



21
22
23
# File 'lib/lono/cfn/rollback.rb', line 21

def status
  Lono::Cfn::Status.new(@stack_name)
end