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

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

Constructor Details

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

Instance Method Details

#deployObject



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

def deploy
  hook_to_run = stack.exists? ? :'after-update' : :'after-create'
  stack.deploy
  warm_up_inactive_stack
  get_parameters_outputs(inactive_stack)
  run_hook(hook_to_run)
end

#destroyObject



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

def destroy
  delete_stack stack
end

#exists?Boolean

Returns:

  • (Boolean)


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

def exists?
  stack.exists?
end

#kill_inactiveObject

Raises:



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

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

#output_value(key) ⇒ Object



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

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:



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

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