class CfDeployer::DeploymentStrategy::BlueGreen

Public Instance Methods

destroy() click to toggle source
# 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_post() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 15
def destroy_post
  #overwrite in sub class
end
exists?() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 5
def exists?
  green_stack.exists? || blue_stack.exists?
end
output_value(key) click to toggle source
# 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) click to toggle source
# 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

Private Instance Methods

active_stack() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 50
def active_stack
  @active_stack = get_active_stack unless @active_stack_checked
  @active_stack
end
blue_stack() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 36
def blue_stack
  name = "#{stack_prefix}-B"
  Stack.new(name, component_name, context)
end
both_stacks_exist?() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 46
def both_stacks_exist?
  blue_stack.exists? && green_stack.exists?
end
get_active_stack() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 64
def get_active_stack
  @active_stack_checked = true
  return green_stack if stack_active?(green_stack)
  return blue_stack if stack_active?(blue_stack)
  nil
end
get_inactive_stack() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 59
def get_inactive_stack
  return blue_stack unless active_stack
  stack_active?(green_stack) ? blue_stack : green_stack
end
green_stack() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 41
def green_stack
  name = "#{stack_prefix}-G"
  Stack.new(name, component_name, context)
end
inactive_stack() click to toggle source
# File lib/cf_deployer/deployment_strategy/blue_green.rb, line 55
def inactive_stack
  @inactive_stack ||= get_inactive_stack
end