Class: BoshDeploymentManifest

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh_deployment_manifest.rb

Overview

BoshDeploymentManifest is used to parse BOSH manifests

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ BoshDeploymentManifest

Returns a new instance of BoshDeploymentManifest.



5
6
7
# File 'lib/bosh_deployment_manifest.rb', line 5

def initialize(path)
  @manifest = YAML.load_file(path)
end

Instance Method Details

#properties_for_instance_group(instance_group_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bosh_deployment_manifest.rb', line 9

def properties_for_instance_group(instance_group_name)
  return @properties[instance_group_name] if @properties && @properties[instance_group_name]

  instance_group = @manifest['instance_groups'].find { |group| group['name'] == instance_group_name }
  return [] unless instance_group

  properties = {}
  instance_group['jobs'].each do |job|
    next unless job.key?('properties')

    job['properties'].each do |key, value|
      inject_properties(properties, job, key, value)
    end
  end

  @properties ||= {}
  @properties[instance_group_name] = properties
end