Class: OpsPreflight::OpsWorks::Deploy

Inherits:
Base
  • Object
show all
Defined in:
lib/ops_preflight/ops_works/deploy.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#stack_name

Instance Method Summary collapse

Constructor Details

#initialize(stack_name, app_name) ⇒ Deploy

Returns a new instance of Deploy.



8
9
10
11
12
# File 'lib/ops_preflight/ops_works/deploy.rb', line 8

def initialize(stack_name, app_name)
  super stack_name

  @app_name = app_name
end

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



6
7
8
# File 'lib/ops_preflight/ops_works/deploy.rb', line 6

def app_name
  @app_name
end

Instance Method Details

#call(release_num = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ops_preflight/ops_works/deploy.rb', line 14

def call(release_num = nil)
  instances = instance_ids
  puts "Triggering deploy of v#{release_num} to #{instances.size} instance#{'s' if instances.size != 1}"

  resp = opsworks.client.create_deployment({
    :stack_id => stack_id,
    :app_id => app_id,
    :instance_ids => instances,
    :command => {
      :name => 'deploy'
    },
    :comment => release_num.nil? ? 'Preflight Deployment' : "Preflight Release v#{release_num}"
  })
end