Class: EbDeployer::CloudFormationDriver

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

Instance Method Summary collapse

Instance Method Details

#create_stack(name, template, opts) ⇒ Object



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

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

#query_output(name, key) ⇒ Object



28
29
30
# File 'lib/eb_deployer/cloud_formation_driver.rb', line 28

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

#stack_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#stack_status(name) ⇒ Object



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

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

#update_stack(name, tempalte, opts) ⇒ Object



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

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