Class: Bosh::Director::DeploymentPlan::CompilationConfig

Inherits:
Object
  • Object
show all
Includes:
ValidationHelper
Defined in:
lib/bosh/director/deployment_plan/compilation_config.rb

Overview

Represents the deployment compilation worker configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ValidationHelper

#invalid_type, #safe_property

Constructor Details

#initialize(deployment, compilation_config) ⇒ CompilationConfig

Creates compilation configuration spec from the deployment manifest.

Parameters:

  • deployment (DeploymentPlan)
  • compilation_config (Hash)

    parsed compilation config YAML section



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bosh/director/deployment_plan/compilation_config.rb', line 31

def initialize(deployment, compilation_config)
  @deployment = deployment
  @workers = safe_property(compilation_config, "workers",
                           :class => Integer, :min => 1)
  network_name = safe_property(compilation_config, "network",
                               :class => String)
  @reuse_compilation_vms = safe_property(compilation_config,
                                         "reuse_compilation_vms",
                                         :class => :boolean,
                                         :optional => true)
  @network = deployment.network(network_name)
  if @network.nil?
    raise CompilationConfigUnknownNetwork,
          "Compilation config references an unknown " +
          "network `#{network_name}'"
  end
  @cloud_properties = safe_property(
      compilation_config, "cloud_properties", :class => Hash)
  @env = safe_property(compilation_config, "env", :class => Hash,
                       :optional => true, :default => {})
end

Instance Attribute Details

#cloud_propertiesHash

Returns cloud properties to use when creating VMs. (optional).

Returns:

  • (Hash)

    cloud properties to use when creating VMs. (optional)



20
21
22
# File 'lib/bosh/director/deployment_plan/compilation_config.rb', line 20

def cloud_properties
  @cloud_properties
end

#deploymentDeploymentPlan

Returns associated deployment.

Returns:



11
12
13
# File 'lib/bosh/director/deployment_plan/compilation_config.rb', line 11

def deployment
  @deployment
end

#envHash

Returns environment to use when creating VMs. (optional).

Returns:

  • (Hash)

    environment to use when creating VMs. (optional)



23
24
25
# File 'lib/bosh/director/deployment_plan/compilation_config.rb', line 23

def env
  @env
end

#networkDeploymentPlan::Network

Returns network used by compilation workers.

Returns:



17
18
19
# File 'lib/bosh/director/deployment_plan/compilation_config.rb', line 17

def network
  @network
end

#reuse_compilation_vmsBool

Returns if VMs should be reused for compilation tasks. (optional).

Returns:

  • (Bool)

    if VMs should be reused for compilation tasks. (optional)



26
27
28
# File 'lib/bosh/director/deployment_plan/compilation_config.rb', line 26

def reuse_compilation_vms
  @reuse_compilation_vms
end

#workersInteger

Returns number of worker VMs to use.

Returns:

  • (Integer)

    number of worker VMs to use



14
15
16
# File 'lib/bosh/director/deployment_plan/compilation_config.rb', line 14

def workers
  @workers
end