Class: CfDeployer::DeploymentStrategy::CreateOrUpdate

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

Constant Summary collapse

BLUE_GREEN_STRATEGY =
false

Instance Attribute Summary

Attributes inherited from Base

#application_name, #component_name, #context, #environment_name

Instance Method Summary collapse

Methods inherited from Base

#blue_green_strategy?, #initialize

Constructor Details

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

Instance Method Details

#deployObject



19
20
21
22
23
24
# File 'lib/cf_deployer/deployment_strategy/create_or_update.rb', line 19

def deploy
  stack.deploy
  warm_up_inactive_stack
  get_parameters_outputs(inactive_stack)
  run_hook(:'after-create')
end

#destroyObject



30
31
32
# File 'lib/cf_deployer/deployment_strategy/create_or_update.rb', line 30

def destroy
  delete_stack stack
end

#exists?Boolean

Returns:



6
7
8
# File 'lib/cf_deployer/deployment_strategy/create_or_update.rb', line 6

def exists?
  stack.exists?
end

#kill_inactiveObject

Raises:



34
35
36
# File 'lib/cf_deployer/deployment_strategy/create_or_update.rb', line 34

def kill_inactive
  raise ApplicationError.new('There is no inactive version to kill for Create or Update Deployments.')
end

#output_value(key) ⇒ Object



26
27
28
# File 'lib/cf_deployer/deployment_strategy/create_or_update.rb', line 26

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

#status(get_resource_statuses = false) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/cf_deployer/deployment_strategy/create_or_update.rb', line 10

def status get_resource_statuses = false
  my_status = {}
  my_status[stack.name] = {}
  my_status[stack.name][:status] = stack.status
  my_status[stack.name][:resources] = stack.resource_statuses if stack.exists? && get_resource_statuses
  my_status
end

#switchObject

Raises:



38
39
40
# File 'lib/cf_deployer/deployment_strategy/create_or_update.rb', line 38

def switch
  raise ApplicationError.new('There is no inactive version to switch to for Create or Update Deployments.  Redeploy the version you want')
end