Class: Bosh::Deployer::Specification

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/deployer/specification.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, config) ⇒ Specification

Returns a new instance of Specification.



18
19
20
21
22
# File 'lib/bosh/deployer/specification.rb', line 18

def initialize(spec, config)
  @config = config
  @spec = spec
  @properties = @spec['properties']
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



16
17
18
# File 'lib/bosh/deployer/specification.rb', line 16

def properties
  @properties
end

#specObject

Returns the value of attribute spec.



15
16
17
# File 'lib/bosh/deployer/specification.rb', line 15

def spec
  @spec
end

Class Method Details

.load_apply_spec(dir) ⇒ Object



8
9
10
11
12
13
# File 'lib/bosh/deployer/specification.rb', line 8

def self.load_apply_spec(dir)
  file = 'apply_spec.yml'
  apply_spec = File.join(dir, file)
  err "this isn't a micro bosh stemcell - #{file} missing" unless File.exist?(apply_spec)
  Psych.load_file(apply_spec)
end

.load_from_stemcell(dir, config) ⇒ Object



3
4
5
6
# File 'lib/bosh/deployer/specification.rb', line 3

def self.load_from_stemcell(dir, config)
  spec = load_apply_spec(dir)
  Specification.new(spec, config)
end

Instance Method Details

#delete(name) ⇒ Object

Parameters:

  • name (String)

    property name to delete from the spec



51
52
53
# File 'lib/bosh/deployer/specification.rb', line 51

def delete(name)
  @spec.delete(name)
end

#director_portString

Returns the port the director runs on.

Returns:

  • (String)

    the port the director runs on



56
57
58
# File 'lib/bosh/deployer/specification.rb', line 56

def director_port
  @properties['director']['port']
end

#update(agent_services_ip, internal_services_ip) ⇒ Object

Update the spec with the IP of the micro bosh instance.

Parameters:

  • agent_services_ip (String)

    IP address of the micro bosh VM

  • internal_services_ip (String)

    private IP of the micro bosh VM



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/bosh/deployer/specification.rb', line 27

def update(agent_services_ip, internal_services_ip)
  # set the director name to what is specified in the micro_bosh.yml
  if config.name
    @properties['director'] = {} unless @properties['director']
    @properties['director']['name'] = config.name
  end

  %w{blobstore nats}.each do |service|
    update_agent_service_address(service, agent_services_ip)
    update_service_address(service, internal_services_ip)
  end

  %w{registry dns}.each do |service|
    update_service_address(service, agent_services_ip)
  end

  update_service_address('director', internal_services_ip)

  update_properties

  @spec
end