Class: Bosh::Director::DeploymentPlan::DeploymentLinkSpecLookup

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

Overview

Used to find link source from link spec in deployment model (saved in DB)

Instance Method Summary collapse

Constructor Details

#initialize(required_link, link_path, deployment_link_spec) ⇒ DeploymentLinkSpecLookup

Returns a new instance of DeploymentLinkSpecLookup.



46
47
48
49
50
# File 'lib/bosh/director/deployment_plan/links/link_lookup.rb', line 46

def initialize(required_link, link_path, deployment_link_spec)
  @required_link = required_link
  @link_path = link_path
  @deployment_link_spec = deployment_link_spec
end

Instance Method Details



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/bosh/director/deployment_plan/links/link_lookup.rb', line 52

def find_link_spec
  job = @deployment_link_spec[@link_path.job]
  return nil unless job

  template = job[@link_path.template]
  return nil unless template

  link_path = template.fetch(@link_path.name, {})[@required_link.type]
  return nil unless link_path

  link_path
end