Class: CfDeployer::DeploymentStrategy::BlueGreen

Inherits:
Base
  • Object
show all
Defined in:
lib/cf_deployer/deployment_strategy/blue_green.rb

Direct Known Subclasses

AutoScalingGroupSwap, CnameSwap

Constant Summary

Constants inherited from Base

CfDeployer::DeploymentStrategy::Base::BLUE_GREEN_STRATEGY

Instance Attribute Summary

Attributes inherited from Base

#application_name, #component_name, #context, #environment_name

Instance Method Summary collapse

Methods inherited from Base

#active_template, #blue_green_strategy?, #initialize, #run_hook

Constructor Details

This class inherits a constructor from CfDeployer::DeploymentStrategy::Base

Instance Method Details

#destroyObject



9
10
11
12
13
# File 'lib/cf_deployer/deployment_strategy/blue_green.rb', line 9

def destroy
  delete_stack green_stack
  delete_stack blue_stack
  destroy_post
end

#destroy_postObject



15
16
17
# File 'lib/cf_deployer/deployment_strategy/blue_green.rb', line 15

def destroy_post
  #overwrite in sub class
end

#exists?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/cf_deployer/deployment_strategy/blue_green.rb', line 5

def exists?
  green_stack.exists? || blue_stack.exists?
end

#output_value(key) ⇒ Object



19
20
21
# File 'lib/cf_deployer/deployment_strategy/blue_green.rb', line 19

def output_value(key)
  active_stack ? active_stack.output(key) : "The value will be referenced from the output #{key} of undeployed component #{component_name}"
end

#status(get_resource_statuses = false) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/cf_deployer/deployment_strategy/blue_green.rb', line 23

def status get_resource_statuses = false
  my_status = {}
  [blue_stack, green_stack].each do |the_stack|
    my_status[the_stack.name] = {}
    my_status[the_stack.name][:active] = stack_active?(the_stack)
    my_status[the_stack.name][:status] = the_stack.status
    my_status[the_stack.name][:resources] = the_stack.resource_statuses if the_stack.exists? && get_resource_statuses
  end
  my_status
end