Class: AwsHelpers::CloudFormation::StackUpdate

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

Instance Method Summary collapse

Constructor Details

#initialize(cloud_formation_client, update_request) ⇒ StackUpdate

Returns a new instance of StackUpdate


8
9
10
11
12
# File 'lib/aws_helpers/cloud_formation/stack_update.rb', line 8

def initialize(cloud_formation_client, update_request)
  @cloud_formation_client = cloud_formation_client
  @update_request = update_request
  @stack_name = update_request[:stack_name]
end

Instance Method Details

#executeObject


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/aws_helpers/cloud_formation/stack_update.rb', line 14

def execute

  puts "Updating #{@stack_name}"
  begin
    @cloud_formation_client.update_stack(@update_request)
    StackProgress.new(@cloud_formation_client, @stack_name).execute
  rescue Aws::CloudFormation::Errors::ValidationError => validation_error
    if validation_error.message == 'No updates are to be performed.'
      puts "No updates to perform for #{@stack_name}."
    else
      raise validation_error
    end
  end

end