Class: AwsHelpers::CloudFormation::CheckStackFailure

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_helpers/cloud_formation/check_stack_failure.rb

Instance Method Summary collapse

Constructor Details

#initialize(cloud_formation_client, stack_name) ⇒ CheckStackFailure

Returns a new instance of CheckStackFailure


9
10
11
# File 'lib/aws_helpers/cloud_formation/check_stack_failure.rb', line 9

def initialize(cloud_formation_client, stack_name)
  @describe_stack = DescribeStack.new(cloud_formation_client, stack_name)
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
20
21
22
# File 'lib/aws_helpers/cloud_formation/check_stack_failure.rb', line 13

def execute
  aws_stack = @describe_stack.execute
  status = aws_stack[:stack_status]
  name = aws_stack[:stack_name]

  if [UPDATE_ROLLBACK_COMPLETE, ROLLBACK_COMPLETE, ROLLBACK_FAILED, UPDATE_ROLLBACK_FAILED, DELETE_FAILED].include?(status)
    raise "Stack #{name} Failed"
  end

end