Class: EbDeployer::AWSDriver::CloudFormationDriver

Inherits:
Object
  • Object
show all
Defined in:
lib/eb_deployer/aws_driver/cloud_formation_driver.rb

Instance Method Summary collapse

Instance Method Details

#create_stack(name, template, opts) ⇒ Object



9
10
11
# File 'lib/eb_deployer/aws_driver/cloud_formation_driver.rb', line 9

def create_stack(name, template, opts)
  cloud_formation.stacks.create(name, template, opts)
end

#query_output(name, key) ⇒ Object



29
30
31
32
# File 'lib/eb_deployer/aws_driver/cloud_formation_driver.rb', line 29

def query_output(name, key)
  output = stack(name).outputs.find { |o| o.key == key }
  output && output.value
end

#stack_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/eb_deployer/aws_driver/cloud_formation_driver.rb', line 5

def stack_exists?(name)
  stack(name).exists?
end

#stack_status(name) ⇒ Object



25
26
27
# File 'lib/eb_deployer/aws_driver/cloud_formation_driver.rb', line 25

def stack_status(name)
  stack(name).status.downcase.to_sym
end

#update_stack(name, template, opts) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/eb_deployer/aws_driver/cloud_formation_driver.rb', line 13

def update_stack(name, template, opts)
  begin
    stack(name).update(opts.merge(:template => template))
  rescue AWS::CloudFormation::Errors::ValidationError => e
    if e.message =~ /No updates are to be performed/
      log(e.message)
    else
      raise
    end
  end
end