Class: Bosh::Director::DeploymentPlan::PlannerLinkLookup

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/deployment_plan/links/link_lookup.rb

Overview

Used to find link source from deployment plan

Instance Method Summary collapse

Constructor Details

#initialize(consumed_link, link_path, deployment_plan, link_network) ⇒ PlannerLinkLookup

Returns a new instance of PlannerLinkLookup.



24
25
26
27
28
29
# File 'lib/bosh/director/deployment_plan/links/link_lookup.rb', line 24

def initialize(consumed_link, link_path, deployment_plan, link_network)
  @consumed_link = consumed_link
  @link_path = link_path
  @jobs = deployment_plan.instance_groups
  @link_network = link_network
end

Instance Method Details



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/bosh/director/deployment_plan/links/link_lookup.rb', line 31

def find_link_spec
  job = @jobs.find { |j| j.name == @link_path.job }
  return nil unless job

  template = job.templates.find { |t| t.name == @link_path.template }
  return nil unless template

  found = template.provided_links(job.name).find { |p| p.name == @link_path.name && p.type == @consumed_link.type }
  return nil unless found

  Link.new(@link_path.name, job, template, @link_network).spec
end